Presentation is loading. Please wait.

Presentation is loading. Please wait.

Point Processing When doing so you actually perform a special type of image processing known as point processing.

Similar presentations


Presentation on theme: "Point Processing When doing so you actually perform a special type of image processing known as point processing."— Presentation transcript:

1 Point Processing When doing so you actually perform a special type of image processing known as point processing.

2 Point processing Point processing is now defined as an operation which calculates the new value of a pixel in g(x, y) based on the value of the pixel in the same position in f (x, y) and some operation. When doing so you actually perform a special type of image processing known as point processing.

3 Point Processing linear Non-linear (Logarithm, Exponential, Gamma, etc.)

4 Gray-Level Mapping g(x, y) = f (x, y)+b NOTE: If b >0 the image becomes brighter and if b < 0 the image becomes darker.

5 exercise

6 Gray-Level Mapping

7 The contrast of an image g(x, y) = a * f (x, y) g(x, y) = a * f (x, y)+b The contrast of an image is changed by changing the slope of the graph If a >1 the contrast is increased and if a <1 the contrast is decreased.

8 Arithmetic operations on an image: multiplication and division

9 Complements Input imageoutput image MATLAB function

10 Non-linear Gray-Level Mapping Gamma Mapping Humans have a non-linear perception of contrast. A commonly used non-linear mapping is gamma mapping

11 Gamma Mapping Gamma-mapping curves for different gammas g(x, y) = f (x, y) γ Adjust the gamma L1 = imadjust(I,[0.3 0.7], [ ],2); figure, imshow(L1) L2 = imadjust(I,[0.3 0.7], [ ],.3); figure, imshow(L2)

12 Gamma Mapping If Vin = 120 is gamma mapped with γ = 2.22. Initially, the pixel value is transformed into the interval [0, 1] by dividing with 255, g’(x,y) = 20/255 = 0.4706. The gamma mapping is performed v2 = 0.47062.22 = 0.1876. Finally, it is mapped back to the interval [0, 255] giving the result v out = 0.1876 / 255 = 47.

13 Logarithmic Mapping An alternative non-linear mapping is based on the logarithm operator. Each pixel is replaced by the logarithm of the pixel value.

14 Logarithmic Mapping the mapping is defined as g(x, y) = c * log(1+f (x, y)) where c is a scaling constant that ensures that the maximum output value is 255 It is calculated as c = 255 / log(1 +v max ) where v max is the maximum pixel value in the input image.

15 Logarithmic Mapping I = imread('pout.tif'); g=c*log(1+double(I)) gs=im2uint8(mat2gray(g)); Input imageOutput image Output Input

16 Exponential Mapping The exponential mapping uses a part of the exponential curve. It can be expressed as where k is a parameter that can be used to change of shape of the transformation curve and c is a scaling constant that ensures that the maximum output value is 255. where v max is the maximum pixel value in the input image. k is normally chosen as a number just above 1. g(x, y) = c *(k f (x,y) − 1)

17 MATLAB function > Im2 = imadjust(I,[],[],0.5); //adjusts gamma: exponential map of grays J = imadjust(I, [low_in; high_in], [low_out; high_out],gamma); Exponential Mapping

18 The Image Histogram “how can we tell if an image is too dark or too bright? “ Histogram equalization is based on non-linear gray- level mapping using a cumulative histogram.

19 The Image Histogram

20 Histogram stretching ini 015 10 20 30 40 570 6110 745 870 935 100 110 120 130 140 15 h = imhist(im, b): h: histogram, b: number of histogram bins

21 The Image Histogram Histogram stretching (Contrast stretching) Histogram Equalization

22 The Image Histogram (con’t) Given a grayscale image, its histogram consists of the histogram of its grey levels

23 Histogram stretching

24 The Image Histogram (con’t) MATLAB function

25 Histogram stretching 5 9

26 This function has the effect of stretching the grey levels 5-9 to grey levels 2-14 by following: i56789 j2581114

27 Perform histogram stretching in Matlab Format  imadjust(im,[a,b],[c,d]) NOTE: images of type double, uint8 or uint16 the values of a, b, c, and d must be between 0 and 1 J = imadjust(I) J = imadjust(I,[low_in; high_in],[low_out; high_out]) J = imadjust(I,[low_in; high_in],[low_out; high_out],gamma)

28 Perform histogram stretching in Matlab >> t=imread('tire.tif'); >> th=imadjust(t,[],[],0.5); >> imshow(t),figure,imshow(th)

29 Example RGB1 = imread('football.jpg'); RGB2 = imadjust(RGB1,[.2.3 0;.6.7 1],[]); imshow(RGB1), figure, imshow(RGB2) Input imageOutput image

30 A piecewise linear stretching function pix=find(im >= a(i) & im < a(i+1)); out(pix)=(im(pix)-a(i))*(b(i+1)-b(i))/(a(i+1)- a(i))+b(i);

31 Histogram equalization The user input is required for histogram starching, and a better approach is provided by histogram equalization, which is an entirely automatic procedure.

32 Histogram equalization ini 015 10 20 30 40 570 6110 745 870 935 100 110 120 130 140 15 h = imhist(im, b): h: histogram, b: number of histogram bins

33 Histogram equalization 15+70 15/360

34 exercise 1.I = imread('tire.tif'); 2.[J,T] = histeq(I); 3.figure;imshow(I); 4.figure; imhist(I,64) 5.figure;imshow(J); 6.figure; imhist(J,64) 7.Plot(T); 3 3 4 4 7 7 6 6 5 5


Download ppt "Point Processing When doing so you actually perform a special type of image processing known as point processing."

Similar presentations


Ads by Google