Project

advertisement
3. Select two edge extraction methods and apply them to both noise and no
noise image and discuss your result.
Solution: the problem is to ask to using different edge extraction methods to
detect the edges in the image. There are several methods such as sobel and
canny methods. We do simulation for three different types of image.
(a) Experimental objective
We chose three objectives: original image, image with Gaussian noise
and blurred image. Then apply Soble and Canny methods for all of them
separately.
(b) Results:
(1) Using edge extraction methods for the original image:
BW1 = edge(f,'sobel');% f is the oringal image and ‘sobel’ is the method we chose
BW2 = edge(f,'canny');% f is the image and ‘canny’ is the method we chose
(2) Using edge extraction methods for the noise image
BW3 = edge(g,'sobel');%g is the noise image and ‘sobel’ is the method
BW4 = edge(g,'canny');
(3) Using edge extraction methods for the noise image
BW5 = edge(blurred,'sobel');% blurred is the blurred image and ‘sobel’ is the method
BW6 = edge(blurred,'canny');
(c) Source code:
f = imread('H:\MyShelf\Study\Digital image process\Pro\Fig3-40a.jpg');
g = imnoise(f,'gaussian',0,0.05);
subplot(3,3,1);
imshow(f); title('Original Image');
subplot(3,3,2);
imshow(g); title('Image with Gaussian noise');
H = fspecial('disk',10);
blurred = imfilter(f,H,'replicate');
subplot(3,3,3);
imshow(blurred); title('Blurred Image');
BW1 = edge(f,'sobel');
BW2 = edge(f,'canny');
subplot(3,3,4);
imshow(BW1); title('Edge extraction for Original Image using Sobel method');
subplot(3,3,5);
imshow(BW1); title('Edge extraction for Original Image using canny method');
BW3 = edge(g,'sobel');
BW4 = edge(g,'canny');
subplot(3,3,6);
imshow(BW1); title('Edge extraction for noise Image using Sobel method');
subplot(3,3,7);
imshow(BW1); title('Edge extraction for noise Image using canny method');
BW5 = edge(blurred,'sobel');
BW6 = edge(blurred,'canny');
subplot(3,3,8);
imshow(BW1); title('Edge extraction for Blurred Image using Sobel method');
subplot(3,3,9);
imshow(BW1); title('Edge extraction for Blurred Image using canny method');
4. Select two image sharpening methods and apply them to different kind of
images and discuss your findings.
Solution: The sharpening methods are to highlight fine detail in an image or
to enhance detail that has been blurred. We use two types of methods in our
project: Sobel and Prewitt.
(a) Experimental objective
The objective is the motion blurred image of the original one.
(b) Results:
(1)Using Sobel method to sharpen the blurred image
h1 = fspecial('sobel');% construct the sobel filter
sharpened = imfilter(f,h1,'replicate');% using sobel filter to sharpen the image, f is the
image, ‘replicate’ means innput array values outside the bounds of the array are assumed
to equal the nearest array border value.
(2) Using Prewitt method to sharpen the blurred image
h2 = fspecial('prewitt');% construct the prewitt filter
sharpened = imfilter(f,h2,'replicate');% using prewitt filter to sharpen the image, f is the
image, ‘replicate’ means innput array values outside the bounds of the array are assumed
to equal the nearest array border value.
(c) Source code
f = imread('H:\MyShelf\Study\Digital image process\Pro\Fig3-40a.jpg');
g = imnoise(f,'gaussian',0,0.05);
h1 = fspecial('sobel');
h2 = fspecial('prewitt');
subplot(2,2,1);
imshow(f); title('Original Image');
H = fspecial('motion',20,45);
MotionBlur = imfilter(f,H,'replicate');
subplot(2,2,2);
imshow(MotionBlur);title('Motion Blurred Image');
sharpened = imfilter(f,h1,'replicate');
subplot(2,2,3);
imshow(sharpened); title('Sharpened image by the method of Sobel');
H = fspecial('unsharp');
sharpened = imfilter(f,h2,'replicate');
subplot(2,2,4);
imshow(sharpened); title('Sharpened image by the method of Prewitt');
Download