Sunteți pe pagina 1din 10

‫بسم هللا الرحمن الرحيم‬

Sudan University of Science and Technology

Master of Biomedical Engineering

Biomedical Image Analysis

Image Enhancement in the Spatial Domain


(Neighbors-hood Operations)

Project No. (3)

Presented by:
Ryan Merghani Ahmed

Group (B)

Date handed in:


25/3/2014
Abstract
The principal objective of enhancement is to process an image so that the result is
more suitable than the original image for a specific application. The word specific
is important, because it establishes at the outset that the enhancement techniques
are very much problem oriented. Thus, for example, a method that is quite useful
for enhancing X-ray images may not necessarily be the best approach for
enhancing pictures of Mars transmitted by a space probe.

Regardless of the method used, however, image enhancement is one of the most
interesting and visually appealing areas of image processing. Image enhancement
approaches fall into two broad categories: spatial domain methods and frequency
domain methods. The term spatial domain refers to the image plane itself, and
approaches in this category are based on direct manipulation of pixels in an image.
Frequency domain processing techniques are based on modifying the Fourier
transform of an image.

There is no general theory of image enhancement. When an image is processed for


visual interpretation, the viewer is the ultimate judge of how well a particular
method works. Visual evaluation of image quality is a highly subjective process,
thus making the definition of a “good image” an elusive standard by which to
compare algorithm performance.

The term spatial domain refers to the aggregate of pixels composing an image.
Spatial domain methods are procedures that operate directly on these pixels.
Spatial domain processes will be denoted by the expression

g ( x, y )  [ f ( x, y )]

Where f(x, y) is the input image, g(x, y) is the processed image, and T is an
operator on f, defined over some neighborhood of (x, y).

1. Implement the histogram equalization to the input images 1 and 2


2. Reduce the salt-and-pepper noise; the input image is 3.
3. Implement the whole procedure listed on the pages 137 to 140 of
the Last lecture. The input image is 4.
Technical discussion
1.
Here we enhance the original image contrast using the histogram equalization
technique; The Histogram Equalization enhances the contrast of images by
transforming the values in an intensity image so that the histogram of the output
image approximately matches a specified histogram.

Firstly (imread) function was used to read image from graphics file, then
(imshow) function used to display the original image, after that (imhist) used to
display histogram of image data, then (histeq) function was used to enhances the
contrast of original image, so that the histogram of the output image approximately
matches a specified histogram, finally we display the enhanced image to make a
comparison.

2.
Here to reduce noise we use filtering operations that are performed directly on the
pixels of an image. We use the term spatial filtering. The process consists simply
of moving the filter mask from point to point in an image. At each point (x, y), the
response of the filter at that point is calculated using a predefined relationship.

Two types of filter were used the first one was a smoothing filter (average filter)
with 3*3 dimension; it was applied using (filter2) function, the second filter used
was an Order-Statistics Filter (median filter) with 3*3 dimension, function
(medfilt2) was used for this purpose, also the function (imshow) was used to
display the original image after been filtered.

3.
Here to enhance these images Laplacian and gradient filters were used to highlight
fine detail, and to enhance prominent edges respectively, first laplacian filter was
used to highlight fine detail, the resultant image was scaled using scaling
technique. Sharpened noisy image was obtained by adding the scaled image to the
original image (assume the obtained image is a), after that we apply gradient filter
on the original image and smooth it using (5*5) average filter (assume the obtained
image is b), then we use the image b as a mask; which had been applied on a, the
result was added to the original image to obtain a final sharpened image, in the
final step a power law transformation was applied to the sharpened image.

All above steps were done using MATLAB function like: imfilter, imshow,
imread and im2double.

Discussion of results

1.
We can notice that the original image in figure (1) (Result1) is a low contrast
image; this observation is from its histogram, original image in figure (2) classified
as a dark Image, figures in (Result1) show that histogram equalization techniques
significantly improve original images quality. We can also see that although the
two original images were different (thus have different histogram); the histogram
equalized images are visually very similar.

2.
From the figure in (Result2) we can notice that averaging filter reduce noise in a
good way, but the resulting image become less sharp and significantly blurring,
unlike median filter which give a sharper image besides reducing noise. In general
we can say that median filtering is much better suited than averaging for the
removal of additive salt-and-pepper noise.

3.
Our objective is to enhance this image by sharpening it and by bringing out more
of the skeletal detail. From the figures in (Result3) we can notice that:

- Image background become gray after applying laplacian filter [as observed
in figure (1)] because the scaling technique which had been used to avoid the
negative values.
- When we add the original image to the laplacian image we obtain image that
is noisy and sharper [as observed in figure (2)].
- When we apply gradient filter on the original image we can observe that
edges are much more dominant in this image than in the Laplacian image [as
observed in figure (2)].
- When we apply gradient filter on the original image and multiply the
smoothed result with the scaled laplacian image we can get preserve details
in the strong areas while reducing noise in the relatively flat areas [as
observed in figure (3)].
- Adding the product image to the original image resulted in a sharpened
image observed in figure (4).Final result obtained by applying a power-law
transformation to the above image to increase the dynamic range of the
sharpened image. We see that significant new detail is visible in the final
figure. The areas around the wrists, hands, ankles, and feet are good
examples of this. The skeletal bone structure also is much more pronounced,
including the arm and leg bones.

The significant increase in sharpness of detail in this image over the original is
evident in most parts of the image, including the ribs, spinal cord, pelvis, and skull.
This type of improvement would not have been possible by using the Laplacian or
gradient alone.

Results
Result1
Figure (1)

original image original image histogram

6000

4000

2000

0
0 100 200

enhanced image enhanced image histogram

6000

4000

2000

0
0 100 200
Figure (2)

original image original image histogram


6000

4000

2000

0
0 100 200

enhanced image enhanced image histogram


6000

4000

2000

0
0 100 200

Result2

noisy image image enhanced using average filter

noisy image image enhanced using median filter


Result3
Figure (1)

original image scaled laplacian image

Figure (2)

Sharped laplacian image sharped scaled gradient image


Figure (3)

enhanced gradient image final mask image

Figure (4)

sharpe image power law image


Appendix
1. Program for proj.1

low=imread('1.tif');
figure(1);
subplot(2,2,1);
imshow(low),title('original image');
subplot(2,2,2);
imhist(low),title('original image histogram');
loweq=histeq(low);
subplot(2,2,3);
imshow(loweq),title('enhanced image');
subplot(2,2,4);
imhist(loweq),title('enhanced image histogram');
dark=imread('2.tif');
figure(2);
subplot(2,2,1);
imshow(dark),title('original image'),
subplot(2,2,2);
imhist(dark),title('original image histogram');
darkeq=histeq(dark);
subplot(2,2,3);
imshow(darkeq),title('enhanced image');
subplot(2,2,4);
imhist(darkeq),title('enhanced image histogram');

2. Program for proj.2

noisy=imread('3.tif');
subplot(2,2,1)
imshow(noisy),title('noisy image');
enhanced=filter2(fspecial('average',3),noisy)/255;
subplot(2,2,2)
imshow(enhanced),title('image enhanced using average filter');
noisy=imread('3.tif');
subplot(2,2,3)
imshow(noisy),title('noisy image');
enhanced1=medfilt2(noisy,[3 3]);
subplot(2,2,4)
imshow(enhanced1),title('image enhanced using median filter');
3. Program for proj.3

bodybone=imread('4.tif');
figure(1)
subplot(1,2,1)
imshow(bodybone),title('original image');
bodybone1=im2double(bodybone);
laplacianmask=[-1 -1 -1;-1 8 -1;-1 -1 -1];
laplacian=imfilter(bodybone1,laplacianmask,'replicate');
scaledlaplacian=(laplacian+0.8157);
scaledlaplacian1=scaledlaplacian/1.6314;
subplot(1,2,2)
imshow(scaledlaplacian1,[]),title('scaled laplacian image');
Sharpenlaplacian=scaledlaplacian1+bodybone1;
figure(2)
subplot(1,2,1)
imshow(Sharpenlaplacian,[]),title('Sharped laplacian image');
gradientmask=[-1 -2 -1;0 0 0;1 2 1];
gradient=imfilter(bodybone1,gradientmask,'replicate');
scaledgradient=(gradient+1.2392);
scaledgradient1=scaledgradient/3.0392;
sharpgradient=scaledgradient1+bodybone1;
subplot(1,2,2)
imshow(sharpgradient,[]),title('sharped scaled gradient image');
enhancedgradient=filter2(fspecial('average',5),sharpgradient)/255;
figure(3)
subplot(1,2,1)
imshow(enhancedgradient,[]),title('enhanced gradient image');
finalmask=Sharpenlaplacian.*enhancedgradient;
subplot(1,2,2)
imshow(finalmask,[]),title('final mask image');
sharpe=bodybone1+finalmask;
figure(4)
subplot(1,2,1)
imshow(sharpe,[]),title('sharpe image');
sharpe1=sharpe.^0.5;
subplot(1,2,2)
imshow(sharpe1,[]),title('power law image');

S-ar putea să vă placă și