Geoscience Reference
In-Depth Information
In most examples the signal-to-noise ratio is unknown and adaptive i lters
(similar to those introduced in Section 6.10) are therefore used for noise
reduction. A Gaussian i lter can be designed using
h = fspecial('gaussian',20,10);
I7 = imfilter(I1,h);
where fspecial creates predei ned 2D i lters, such as moving average,
disk, or Gaussian i lters. h e Gaussian i lter weights h are calculated using
fspecial('gaussian',20,10) , where 20 corresponds the size of a 20-by-20
pixel i lter following the shape of a Gaussian probability density function
with a standard devation of 10 . Next, we calculate I8 , which is a median-
i ltered version of I1 .
I8(:,:,1) = medfilt2(I1(:,:,1),[20 20]);
I8(:,:,2) = medfilt2(I1(:,:,2),[20 20]);
I8(:,:,3) = medfilt2(I1(:,:,3),[20 20]);
Since medfilt2 only works for two-dimensional data, we again apply the i lter
separately to each color (red, green and blue). h e i lter output pixels are the
medians of the 20-by-20 neighborhoods around the corresponding pixels in
the input image.
h e third i lter example deals with sharpening an image using imsharpen .
I9 = imsharpen(I1);
h is function calculates the Gaussian lowpass i ltered version of the image
that is used as an unsharp mask, i.e., the sharpened version of the image is
calculated by subtracting the blurred i ltered version from the original image.
h e function comes with several parameters that control the ability of the
Gaussian i lter to blur the image and the strength of the sharpening ef ect,
and a threshold specifying the minimum contrast required for a pixel to be
considered an edge pixel and sharpened by unsharp masking. Comparing
the results of the three i ltering exercises with the original image
subplot(2,2,1), imshow(I1), title('Original Image')
subplot(2,2,2), imshow(I7), title('Gaussian Filter')
subplot(2,2,3), imshow(I8), title('Median Filter')
subplot(2,2,4), imshow(I9), title('Sharpening Filter')
clearly demonstrates the ef ect of the 2D i lters. As an alternative to these
time-domain i lters, we can also design 2D i lters with a specii c frequency
response, such as the 1D i lters described in Section 6.9. Again, the topic by
Gonzalez and others (2009) provides an overview of 2D frequency-selective
i ltering for images, including functions used to generate such i lters. h e
authors also demonstrate the use of a 2D Butterworth lowpass i lter in image
Search WWH ::




Custom Search