image processing ch3: intensity transformation and spatial filters part 1 prepared by: tahani khatib

17
Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Upload: cierra-lobb

Post on 14-Dec-2015

230 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Image Processing

Ch3: Intensity Transformation and spatial filters

Part 1Prepared by: Tahani Khatib

Page 2: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Image Enhancement?

Enhancement : الصورة is to process an تحسينimage so that the result is more suitable than the original image for a specific application.

Enhancement techniques fall into 2 types: Spatial domain: direct manipulation of pixels in the image plane

Frequency domain: modifying Fourier transform of the image.

In this chapter, we are going to discuss spatial domain techniques

Ch3, lesson1: Background

Page 3: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Spatial domain Spatial domain: aggregateتجمع of pixels

composing an imageSpatial domain processes:

g(x,y) = T[f(x,y)]Input image

Processed (output) image

Operator T defined on some neighborhood of f(x,y)

Ch3, lesson1: Background

Page 4: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Defining a neighborhood (T)

types of neighborhood:types of neighborhood:

1. intensity transformation: neighborhood of size 1x12. spatial filter (or mask ,kernel, template or window): neighborhood of

larger size , like in the above example.

Ch3, lesson1: Background

This rectangle is called neighborhood or mask

Operator T is applied at each location (x,y) to produce the output g at that location. المربع يطبق

النتاج االصلية الصورة كل علىالجديدة الصورة

Page 5: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Intensity transformations functions The smallest mask is of size 1x1 (1 pixel) Here, T is called intensity transformation function

or (mapping, gray level function)

g(x,y) = T[f(x,y)]

s= T(r) s,r : denote the intensity of g and f at any point

(x,y) .

Ch3, lesson1: Background

s r

Page 6: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Intensity transformations functions

Ch3, lesson1: Background

Intensity transformation functions fall into 2 approaches:

1) Basic intensity transformationsa) Linear ( negative and identity).b) logarithmic ( Log and Inverse Log) .c) Power( nth power and nth root).

2) piecewise Linear transformation functions.a) Contrast stretching, thresholdingb) Gray-level slicingc) Bit-plane slicing

Page 7: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Basic intensity (gray level) transformations

Ch3, lesson2: Basic gray level transformation

a) Linear ( negative and identity).b) logarithmic ( Log and Inverse Log) .c) Power( nth power and nth root).

اللونية بعد gray levelsالتدرجات بالصورةالتعديل

البكسل, في كان ان سيكون bit 8فمثال)L=256تدرج (256هناك

اللونية قبل gray levelsالتدرجات بالصورةالتعديل

Page 8: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Basic intensity (gray level) transformations Linear ( negative and identity)

Ch3, lesson2: Basic gray level transformation

Image (r(

The negative of an image with intensity levels in the range [0,L-1] is obtained by using the negative transformation :

s= L-1-r

Advantages of negative : Produces an equivalent of a photographic negative. Enhances white or gray detail embedded in dark regions.

Image (s( after applying T (negative)

Page 9: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Basic intensity (gray level) transformations Linear ( negative and identity)

Ch3, lesson2: Basic gray level transformation

The negative of an image with intensity levels in the range [0,L-1] is obtained by using the negative transformation :

s= L-1-r

Examplethe following matrix represents the pixels values of an 8-bit image (r) , apply negative transform and find the resulting image pixel values.

solution:L= 28 = 256

s=L-1-rs =255-r

Apply this transform toeach pixel to find the negative

1001109095

98140145135

89908885

10210599115

155145165160

157115110120

166165167170

153150156140

Image (r)

Image (s)

Page 10: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Basic intensity (gray level) transformationsLinear ( negative and identity)

Ch3, lesson2: Basic gray level transformation

Exercise:

the following matrix represents the pixels values of a 5-bit image (r) , apply negative transform and find the resulting image pixel values.

solution:

21262930

19212030

16162631

19182723

Image (r)

Image (s)

Page 11: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Ch3, lesson3: piecewise Linear transformation functions.

Assume that a: rmin ,b:rmax ,

k : intensity

Contrast stretching: (r1,s1)=(rmin,0) , (r2,s2)=(rmax,L-1)Thresholding: (r1,s1)=(k,0) , (r2,s2)=(k,L-1)

(r1, s1)

(r2, s2)

piecewise Linear transformation functions.1. Contrast stretching and thresholding

(r2, s2)

(r1, s1)

Thresholding:Contrast stretching

Page 12: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Example: in the graph, suppose we have the following intensities : a=90, b=180, m=100

if r is above 180 ,it becomes 255 in s.

If r is below 90 , it becomes 0,

If r is between 90, 180 , T applies as follows:

when r < 100 , s closes تقتربto zero (darker)

when r>100 , s closes to 255 (brighter)

If r >180; s =255If r <180 and r<90; s=T(r)If r <90; s =0

T=

This is called contrast stretching, which means that the bright pixels in the image will become brighter and the dark pixels will become darker, this means : higher contrast image.

Pixels above 180 become 255

Pixels less than 90 become 0

g(x,y) = T[f(x,y)]Or

s= T(r)

Remember that:

darker

brighter

0 255

255

piecewise Linear transformation functions.Contrast stretching

Ch3, lesson3: piecewise Linear transformation functions.

Page 13: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Image (r(Image (s( after applying T (contrast stretching)

Notice that the intensity transformation function T, made the pixels with dark intensities darker and the bright ones even more brighter, this is called contrast stretching>

Examplepiecewise Linear transformation functions.Contrast stretching

Ch3, lesson3: piecewise Linear transformation functions.

Page 14: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Example: suppose m= 150 (called threshold),

if r (or pixel intensity in image f االصلية is ( الصورةabove this threshold it becomes 1 in s (or pixel intensity in image g التعديل بعد otherwise ,(الصورةit becomes zero.

If f(x,y)>150; g(x,y)=1If f(x,y)<150; g(x,y)=0T=

If r >150; s =1If r <150; s =0

T=

Or simply…

This is called thresholding, and it produces a binary image!

Pixels above 150 become 1

Pixels less than 150 become 0

g(x,y) = T[f(x,y)]Or

s= T(r)

Remember that:

255

2550

piecewise Linear transformation functions.thresholding

Ch3, lesson3: piecewise Linear transformation functions.

Page 15: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

Image (s( after applying T (Thresholding)

Notice that the intensity transformation function T, convert the pixels with dark intensities into black and the bright pixels into white. Pixels above threshold is considered bright and below it is considered dark, and this process is called thresholding.

piecewise Linear transformation functions.thresholding

Ch3, lesson3: piecewise Linear transformation functions.

Image (r(

Page 16: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

piecewise Linear transformation functions.Application on Contrast stretching and thresholding

Ch3, lesson3: piecewise Linear transformation functions.

8-bit image with low contrast

After contrast stretching

(r1,s1)=(rmin,0) , (r2,s2)=(rmax,L-1)

Thresholding function

(r1,s1)=(m,0) , (r2,s2)=(m,L-1)

m : mean intensity level in the image

Page 17: Image Processing Ch3: Intensity Transformation and spatial filters Part 1 Prepared by: Tahani Khatib

11012090130

919498200

909199100

82968590

Exercise:

the following matrix represents the pixels values of a 8-bit image (r) , apply thresholding transform assuming that the threshold m=95, find the resulting image pixel values.

solution:

Image (r)

Image (s)

Ch3, lesson3: piecewise Linear transformation functions.piecewise Linear transformation functions.Exercise on Contrast stretching and thresholding