Intensity Transformations and Spatial Filtering Basics of Intensity
Intensity Transformations and Spatial Filtering
Basics of Intensity Transformation and Spatial Filtering �Spatial Domain Process �Neighborhood is rectangle, centered on (x, y), and much smaller in size than image. �Neighborhood size is 1 x 1, 3 x 3, 5 x 5, etc.
Intensity Transformation is Intensity Transformation, if the neighborhood size is 1 x 1. �Intensity Transformation can be written as follows � s = T[r], where s = g(x, y), and r = f(x, y) �T[f(x, y)]
Image Negatives s = L-1 – r where intensity level is in the range [0, L-1] �
Log Transformations � �Log s = c Log(1+r) Transformation is used to expand the value of the dark pixels while compressing the higher-level value. �It is used to compress the intensity of an image which has very large dynamic range.
Log Transformations of Fourier Spectrum Original Image Fourier Spectrum Log Transform of Fourier �We cannot see the Fourier spectrum, Spectrum because its dynamic range is very large.
Power-Law (Gamma) Transformations � �If <1, expand dark pixels, compress bright pixels. �If >1, compress dark pixels, expand bright pixels.
Examples of Gamma Transformations
Contrast Stretching �If r<r 1 then s = r*s 1/r 1 �If r 1<= r<=r 2 then s = (r-r 1)*(s 2 -s 1)/(r 2 -r 1)+s 1 �If r>r 2 then s = (r-r 2)*(255 -s 2)/(255 -r 2)+s 2 �If r 1=r 2 and s 1=0, s 2=255, the transform is called “Threshold Function”.
Examples of Contrast Stretching
Contrast Stretching in Medical Image �Window Width/Level(Center) s 1=0, s 2=255 width (w)=r 2 -r 1, level (c)=(r 1+r 2)/2
Histogram & PDF �h(r) = nr where nr is the number of pixels whose intensity is r. �The Probability Density Function (PDF)
Cumulative Distribution Function (CDF) PDF CDF Transfer Function s r
Example of Histogram and Cumulative Distribution Function (CDF)
Low Contrast Image High Concentrat e �The Low Concentrat e image is highly concentrated on low intensity values. �The low contrast image is the image which is highly concentrated on a narrow histogram.
Histogram Equalization �The Histogram Equalization is a method which makes the histogram of the image as smooth as possible
The PDF of the Transformed Variable � �s = Transformed Variable. � = The PDF of r = The PDF of s �
Transformation Function of Histogram Equalization �The PDF of s
Histogram Equalization Example Intensity # pixels CDF of Pr 0 20 20/100 = 0. 2 1 5 (20+5)/100 = 0. 25 2 25 (20+5+25)/100 = 0. 5 3 10 (20+5+25+10)/100 = 0. 6 4 15 (20+5+25+10+15)/100 = 0. 75 5 5 (20+5+25+10+15+5)/100 = 0. 8 6 10 (20+5+25+10+15+5+10)/100 = 0. 9 7 10 (20+5+25+10+15+5+10+10)/100 = 1. 0 Total 100 1. 0
Histogram Equalization Example (cont. ) Intensity (r) No. of Pixels (nj) Acc Sum of Pr Output value Quantized Output (s) 0 20 0. 2 x 7 = 1. 4 1 1 5 0. 25*7 = 1. 75 2 2 25 0. 5*7 = 3. 5 3 3 10 0. 6*7 = 4. 2 4 4 15 0. 75*7 = 5. 25 5 0. 8*7 = 5. 6 6 6 10 0. 9*7 = 6. 3 6 7 10 1. 0 x 7 = 7 7 Total 100
Histogram Matching �How to transform the variable r whose PDF is to the variable t whose PDF is. r T( ) s G-1( ) t
- Slides: 21