Presentation is loading. Please wait.

Presentation is loading. Please wait.

©Soham Sengupta, 20151.

Similar presentations


Presentation on theme: "©Soham Sengupta, 20151."— Presentation transcript:

1 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 20151

2 Image Enhancement Topics today: 1.why enhance an image? 2.Enhancement techniques : spatial domain 3.Spatial-domain operations on image to enhance it A. Invert B.Converting to Grayscale C.Contrast intensification 4. Understanding histogram of a digital image : create, view and analyze for different images (case study)

3 Why and what to Enhance? To view things more prominent Wish to desire in reverse shade. [Examples ?] ‘More accurate or prominent’ invites vagueness Means different to different situations, people and systems No single or objective technique but is very subjective Can be performed on both spatial and frequency domains 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 20153

4 Representation of a Digital image 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 20154

5 Spatial Domain Operation Generalized  m=f(x,y): =Pixel value of the pixel (x,y)  In image enhancement technique in spatial domain we manipulate pixel values  G(x,y) = ψ (F(x,y)) is the technique  ψ is the operator (Logic )  ψ is said to be linear iff Ψ ( c 1 A + c 2 B) = c 1 ψ(A) +c 2 Ψ(B) More accurately, ψ(∑c i Z i ) =∑ c i ψ(Z i ) 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 20155

6 Grayscale range revisited Binary image? What is the span of grayscale of a binary image? k-bit Grayscale implies L=2 k different shades (0 to L-1) How many shades possible with 8-bit gray scale? 256 Maximum & minimum values of a pixel in 8-bit grayscale? 0, 255 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 20156

7 Histogram of a Digital Image A statistical histogram showing the distribution of pixel values over a grayscale map. To plot, Along X-axis : Value of Grayscales (0 to L-1) L=2 K for k-bit grayscale In 8-bit grayscale map, X min =0 implies total black X max 255 means total white. Intermediate discrete integers mean shades from darker to brighter values To plot, along Y-axis: Number of pixels having a particular grayscale value. 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 20157

8 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 20158

9 Algorithm to Generate a Histogram Input:  Image (img) 1. If ( image is not grayscale ){ img= convertToGrayScale(img); // WHY? } 2.M: =widthOf(img); N:=heightOf(img); 3.int x[256]; 4.For(row=0;row<M;row++){ for(col=0;col<N;col++){ k=graySclaeValue(img, i,j); // value of the pixel at (i,j) // Dear Students, You Develop it from here } 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 20159

10 Interpretation of Histogram Clustered towards left (origin)  mostly darker images Clustered towards right  brighter images Small band of histogram  Low contrast image Wider band evenly distributed  High contrast image DEMO ? 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 201510

11 Algorithm to Invert an image Input:  Image (img) 1. If ( image is not grayscale ){ img= convertToGrayScale(img); // WHY? } 2.M: =widthOf(img); N:=heightOf(img); 3.int x[256]; 4.For(row=0;row<M;row++){ for(col=0;col<N;col++){ p=graySclaeValue(img, i,j); // value of the pixel at (i,j) Ω = (L-1) – p setNewPixelValue ( i,j, Ω) } k= Grayscale depth L = 2 K You need not worry about:  convertToGrayScale(img)  setNewPixelValue(I,j, Ω ) 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 201511

12 Histogram Interpretation of Inversion Case studies:  Gather different images from anywhere you can  Invert image(s) by Software (Given with my Slide)  Observe patterns of Histogram  Write down the results and try to find an empirical relation between inversion and distribution of pixel values with different values of k 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 201512

13 Grayscale conversion Rough overview of color models: Our everyday images follow RGB or ARGB model A stands for Alpha-channel, deciding transparency or opacity of a pixel. It’s 32 bit pixel value 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 201513

14 Grayscale Conversion Continued. 1.Separate out Red, Green and Blue Components from ARGB 2. P := Pixel value (32-bit) 3. Red component can be found out as: i. R = P & 0x00ff0000 4. Green component could be found as: i. G= P & 0x0000ff00 5. Blue component can be found out as: i. B = P & 0x000000ff 6. Finally, grayscale value is computed as:  2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 201514

15 Assignment-1 Take an image as input Write down the Algorithm of creating its grayscale image If you know any programming language, test it Create histogram of the resulted image 2/28/2015soham.jisit@gmail.com ©Soham Sengupta, 201515


Download ppt "©Soham Sengupta, 20151."

Similar presentations


Ads by Google