1. Name-Anish Hemmady
Project 2
Low level Image Processing
I have applied following low level processing in python programming :
1) Histogram equalization
2) Log Transformation
3) Median Filter
4) Gaussian filter-1D and 2D both have been implemented
5) Image rotation
6) Noise experiments have been carried out using Gaussian and median filters
1) Histogram equalization:
In histogram equalization we have to distribute the intensity values of given image since some
intensity values are clustered as a group together which can contribute to more intensity in
certain regions and less in others. We want to distribute these intensities equally that’s why we
use histogram equalization method. We want to get more accurate information of certain regions
which is made possible through histogram equalization. We make use of cumulative density
function of histogram.
Following are images output which have been generated without any external library usage for
histogram equalization.
Mine program has given foll output:
Input image Output image(after histogram equalz.)
4. Ct_scan initial image histogram
After histogram equalization:
These histograms you can generate easily from my code.Similarly you can get other images
histogram and compare your results. See how the intensity has spreaded evenly.
Now let us look at output images generated by using inbuilt library function:
Using Library function outputs:
Left handside images are input images and right handside are output images
5.
6. These output images generated by inbuilt library functions are exactly similar to what I have
generated using my coding for histogram equalization.
2) Median filter-Median filter uses neighbouring pixel information to fix middle pixel values of
the sliding window or mask moving on it.It makes use of sorting technique to get the neighbours
sorted and then picks up the median value and places it as middle pixel value.
Median filter removes completely salt and pepper noise.its really good against it.
Below I have shown output on Noise experiments carried out on images using median
filtering to clear out the noise.
Amount of noise added is 0.09 for all images shown below (in program its 1-0.01)
These outputs are results without using any inbuilt library of medianfilter:
Lefthandside consists of noisy image and righthandside consists of output after median
filter
(child.pnm)
9. 3) Log Transformation-Log Transformation is done to increase brightness in darker
regions, its like contrast stretching . It lights up the darker parts of images. It makes use
of formula c*(1+log(r)) where r is the intensity value.
Below are the outputs generated using log transformation without using library function:
Using library function it gives us same output it’s the same syntax for library.
10.
11. 4) Gaussian Filter-Gaussian filter is used to smoothen image but it tough to remove salt and
pepper noise.It depends upon sigma value which is applied to the Gaussian filter. If sigma value
is large it removes most of salt and pepper noise but in this process it tried to blur image.This is
the problem og Gaussian filter. It can be done in 2d and 1d,it can be done in 1d since Gaussian
filter is separable.I have implemented in both ways. Also Gaussian filter in 1-D is faster than 2-D
filter. I have some good results noted down.If sigma increases noise is reduced by blurring
occurs more.
Below is the output of Gaussian 2-D kernel without inbuilt library:(Input images contain
noise and output images are after applying Gaussian filtering-see noise on rhs.lhs is input
image)
Sigma value used is 1.5 Noise type-salt and pepper, amount-0.09 for all images
Input Image Output Image
12. Below is the output generated using inbuilt library of Gaussian filter in matlab
Input Image Output Image
13. Now using 1-D Gaussian kernel I get similar results:
14.
15. From the above results we can see that Gaussian filter cannot completely eliminate salt
and pepper noise,it blurs it out
Noteable Facts of Gaussian filter
Time taken by Gaussian kernel in 1-D is less as compared to 2-D kernel to filter out the
image.
Gaussian Kernel type Time taken(milliseconds) Input image
size(width*height) pixels
1-D 7.0542585998 (341, 374)
2-D 11.3605490906 (341, 374)
1-D 0.819472711185 (128, 128)
2-D 1.90503216172 (128, 128)
5) Image Rotation: Image Rotation is performed by going backwards method,in which one
has to first loop through new image where new pixel values will be placed and find out the point
in input image where this current pixel of output will be replaced. This is done by multiplying
inverse of rotation matrix with output image x,y coordiantes and translating back to origin.First
translate back to origin then rotate it with inverse matrix, you will get x,y coordinates.Using
these x,y coordinates first draw out the pixel intensity value in the input image and then place
this intensity value in output image.This method avoids aliasing effect in output image.Dont
forget to translate back after rotation by translating back by same amount from origin to rotate
image about its center.The translating factor is width/2 and height/2 of input image.
16. Images shown below is rotated at angle 45 degrees therefore its anticlockwise direction. If -45
then clockwise.
Following are output images without using inbuilt library of imroatate in python
Input Image OutputImage
19. Conclusion:
Low level processing Technique Its use
Histogram equalization Spread the intensity evenly
Log Transformation See darker regions clearly
Median filter Eliminate the salt and pepper noise
completely
Gaussian Filter (1-D and 2-D) Doesnt eliminate salt and pepper noise
completely but blurs it out
Image Rotation Rotate an image by specific angle clockwise
if negative angle and counter clockwise if
positive angle