intensity transformations and spatial filtering

21
Intensity Transformations and Spatial Filtering

Upload: grady-sexton

Post on 02-Jan-2016

68 views

Category:

Documents


1 download

DESCRIPTION

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 1x1, 3x3, 5x5, etc. Intensity Transformation. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Intensity Transformations and Spatial Filtering

Intensity Transformations and Spatial Filtering

Page 2: 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 1x1, 3x3, 5x5, etc.

, ,g x y T f x y Origin (0,0)

(x,y)

(M-1,0)

(0,N-1)

3x3 Neighborhood of (x,y)

Page 3: Intensity Transformations and Spatial Filtering

Intensity TransformationT[f(x,y)] is Intensity

Transformation, if the neighborhood size is 1x1.

Intensity Transformation can be written as follows

s = T[r],

where s = g(x,y), and r = f(x,y)

Page 4: Intensity Transformations and Spatial Filtering

Image Negatives s = L-1 – r

where intensity level is in the range[0, L-1]

Page 5: Intensity Transformations and Spatial Filtering

Log Transformations s = c Log(1+r)

Log 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.

Page 6: Intensity Transformations and Spatial Filtering

Log Transformations of Fourier Spectrum

Original Image

Fourier Spectrum

Log Transform of

Fourier SpectrumWe cannot see the Fourier spectrum,

because its dynamic range is very large.

Page 7: Intensity Transformations and Spatial Filtering

Power-Law (Gamma) Transformations

If <1, expand dark pixels, compress bright pixels.

If >1, compress dark pixels, expand bright pixels.

0.04 0.10

0.20 0.40

0.64

1.0

1.5

2.5 5.0

10.0

s cr

Page 8: Intensity Transformations and Spatial Filtering

Examples of Gamma Transformations

3.0

4.0 5.0

Page 9: Intensity Transformations and Spatial Filtering

Contrast StretchingIf r<r1 then

s = r*s1/r1If r1<= r<=r2 then

s = (r-r1)*(s2-s1)/(r2-r1)+s1If r>r2 then

s = (r-r2)*(255-s2)/(255-r2)+s2If r1=r2 and s1=0,s2=255, the

transform is called “Threshold Function”.

Page 10: Intensity Transformations and Spatial Filtering

Examples of Contrast Stretching

Page 11: Intensity Transformations and Spatial Filtering

Contrast Stretching in Medical Image

Window Width/Level(Center) s1=0,s2=255

width (w)=r2-r1, level (c)=(r1+r2)/2

Page 12: Intensity Transformations and Spatial Filtering

Histogram & PDF

h(r) = nr

where nr is the number of pixels whose intensity is r.

The Probability Density Function (PDF) h r

p rM N

Page 13: Intensity Transformations and Spatial Filtering

Cumulative Distribution Function (CDF)

PDF CDF

Transfer Function

r

s

0

rCDF r p r dr

Page 14: Intensity Transformations and Spatial Filtering

Example of Histogram and Cumulative Distribution Function (CDF)

Page 15: Intensity Transformations and Spatial Filtering

Low Contrast Image

The image is highly concentrated on low intensity values.

The low contrast image is the image which is highly concentrated on a narrow histogram.

HighConcentra

te

LowConcentra

te

Page 16: Intensity Transformations and Spatial Filtering

Histogram Equalization

The Histogram Equalization is a method which makes the histogram of the image as smooth as possible

Page 17: Intensity Transformations and Spatial Filtering

The PDF of the Transformed Variable

s = Transformed Variable.

= The PDF of r = The PDF of s

s T r

rp r

sp s

1

/

s r

r

drp s p r

ds

p rdT r dr

Page 18: Intensity Transformations and Spatial Filtering

Transformation Function of Histogram Equalization

The PDF of s

0255

r

rs T r p r dr

0255

255

1

255

r

r

r

s r

dT rds

dr drd

p r drdrp r

drp s p r

ds

Page 19: Intensity Transformations and Spatial Filtering

Histogram Equalization Example

Intensity # pixels

0 20

1 5

2 25

3 10

4 15

5 5

6 10

7 10

Total 100

CDF of Pr

20/100 = 0.2

(20+5)/100 = 0.25

(20+5+25)/100 = 0.5

(20+5+25+10)/100 = 0.6

(20+5+25+10+15)/100 = 0.75

(20+5+25+10+15+5)/100 = 0.8

(20+5+25+10+15+5+10)/100 = 0.9

(20+5+25+10+15+5+10+10)/100 = 1.0

1.0

Page 20: Intensity Transformations and Spatial Filtering

Histogram Equalization Example (cont.)

Intensity (r)

No. of Pixels(nj)

Acc Sum of Pr

Output value Quantized Output (s)

0 20 0.2 0.2x7 = 1.4 1

1 5 0.25 0.25*7 = 1.75 2

2 25 0.5 0.5*7 = 3.5 3

3 10 0.6 0.6*7 = 4.2 4

4 15 0.75 0.75*7 = 5.25 5

5 5 0.8 0.8*7 = 5.6 6

6 10 0.9 0.9*7 = 6.3 6

7 10 1.0 1.0x7 = 7 7

Total 100

Page 21: Intensity Transformations and Spatial Filtering

Histogram MatchingHow to transform the variable r

whose PDF is to the variable t whose PDF is .

0

0

1

255

255

r

r

t

t

s T r p r dr

G t p t dt s

t G t

rp r

tp t

r T( ) s G-1( ) t