1 / 26

Manipulating contrast/point operations

Manipulating contrast/point operations. Examples of point operations:. Threshold (demo) Invert (demo) Out[ x,y ] = max – In[ x,y ] RGB  gray conversion Gamma correction Other methods histogram equalization color to gray scaling. Gray to binary. Thresholding G  B

siran
Download Presentation

Manipulating contrast/point operations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Manipulating contrast/point operations

  2. Examples of point operations: • Threshold (demo) • Invert (demo) Out[x,y] = max – In[x,y] • RGB  gray conversion • Gamma correction • Other methods • histogram equalization • color to gray • scaling

  3. Gray to binary • Thresholding • G  B const int t=200; if (G[r][c]>t) B[r][c]=1; else B[r][c]=0; How do we choose t? • Interactively • Automatically

  4. Gamma correction

  5. Histogram equalization

  6. Histogram equalization • For many images we observe that it only uses a few different gray values. • Often these gray values are close together.

  7. Histogram equalization • Histogram equalization goals: • Output image should use all gray values. • Output image has same number of pixels of each gray value. • Which distribution is then preferred? (normal or uniform) • (While maintaining the relationship (order) among gray values. - George’s rule.)

  8. Histogram equalization from http://en.wikipedia.org/wiki/Histogram_equalization

  9. Histoeq example(from http://www.cs.utah.edu/~jfishbau/improc/project2/images/crowd_hist_compare.png)

  10. Histogram equalization • Histogram equalization attempts to remap the input gray values to output gray values s.t. the histogram of the output achieves goals 1 and 2 (and 3) as best as possible.

  11. Histoeq example(from http://web2.clarkson.edu/class/image_process/qa1/Histogram%20Equalization%20Example_files/img92.gif)

  12. Histogram • Step 1: Estimate probability of a given gray value in an image. • h(g) = count of pixels w/ gray value equal to g. • histogram • p(g) = h(g) / (w*h) • w*h = # of pixels in entire image • Demo histogram.

  13. Histogram equalization • Step 2: Estimate c.d.f. (cumulative distribution function).

  14. Histogram equalization • Step 3: Use c.d.f. to map an input gray value g to “equalized” gray value, g’. • Note: Since cdf(g) is in [0..1], we need to multiply by the max gray value so the result is in [0..max]. • Note: Calculate above only once for each gray value, save in a (lookup) table, and then let g’=lut[g].

  15. Histogram equalization • Only gray eq discussed so far. • What about color? • Create 3 separate histograms for R, G, and B, and then equalize each individually (same as gray). • Better way is to convert RGB to color space with luminance (e.g., CIE XYZ, YIQ, YUV, HSL, or HSV), equalize luminance (same as gray), then convert back to RGB.

  16. Histogram equalization algorithm • Do Exercise 5.2 for homework.

  17. Scaling A range of gray values

  18. What about gray data that is less than 8 bits? • Linearly map input [0,K] to [0,255].

  19. What about gray data that is less than 8 bits? • What if our minimum input value is something other than 0?

  20. What about gray data that is more than 8 bits? • Linearly map input min to 0 and input max to 255. • But we then compress (lose) our dynamic range, i.e., lose details. • Map subranges of gray data to [0..255]. • A.K.A. window width and level.

  21. from http://www.netterimages.com/images/vpv/000/000/061/61653-0550x0475.jpg

  22. Window width and level • Map subranges of gray data to [0..255]. • A.K.A. window width and level.

  23. Window width and level • Map subranges of gray data to [0..255]. • A.K.A. window width and level.

  24. from https://www.imt.liu.se/people/dafor/visualization_files/image001.png

  25. Color to gray conversion

  26. Standard conversion from rgb to gray • NTSC luminance int luminance = (int)(0.30*r + 0.59*g + 0.11*b + 0.5); if (luminance<0) luminance = 0; if (luminance>255) luminance = 255; http://www.tektronix.com/Measurement/cgi-bin/framed.pl?Document=/Measurement/App_Notes/NTSC_Video_Msmt/colorbars.html&FrameSet=television

More Related