Geoscience Reference
In-Depth Information
median-i ltered version of the
I2
image is, of course, very smooth compared
to the original
I1
image. We would, however, lose a lot of detail if we used
this version of the image. We next subtract the median-i ltered image
I2
from original image
I1
, which yields the image
I3
.
I3 = imsubtract(I1,I2);
imshow(I3,'InitialMagnification',200)
title('I1-I2')
We then subtract the original image
I1
from the median-i ltered image
I2
,
which yields the image
I4
.
I4 = imsubtract(I2,I1);
imshow(I4,'InitialMagnification',200)
title('I2-I1')
We next replace the original pixels with their median-i ltered versions if the
dif erence between the median-i ltered image
I2
and the original image
I1
is
great than 10 in both directions (as it is in our example).
I5 = I1;
I5(I3>10 | I4>10) = I2(I3>10 | I4>10);
imshow(I5,'InitialMagnification',200)
title('Despeckled Image')
h e image
I5
obtained using this approach is the despeckled version of the
image
I1
. We can also explore the pixel values of both versions of the image
(
I1
and
I5
) in a 3D surface plot, using
subplot(1,2,1)
I1S = im2double(I1);
surface(I1S), colormap jet, caxis([0 1])
shading interp, view(120,33), axis off
axis([1 size(I1,1) 1 size(I1,2) min(I1S(:)) max(I1S(:))])
subplot(1,2,2)
I5S = im2double(I5);
surface(I5S), colormap jet, caxis([0 1])
shading interp, view(120,33), axis off
axis([1 size(I1,1) 1 size(I1,2) min(I1S(:)) max(I1S(:))])
We need convert the image data to class
double
using
im2double
in order to be
able to display the data using
surface
. Finally, we can display both images in
the same i gure window
subplot(1,2,1), imshow(I1), title('Original Image')
subplot(1,2,2), imshow(I5), title('Despeckled Image')
to see the result of despeckling the image
I1
(Fig. 8.2).