Presentation is loading. Please wait.

Presentation is loading. Please wait.

Image (and Video) Coding and Processing Lecture 5: Point Operations Wade Trappe.

Similar presentations


Presentation on theme: "Image (and Video) Coding and Processing Lecture 5: Point Operations Wade Trappe."— Presentation transcript:

1 Image (and Video) Coding and Processing Lecture 5: Point Operations Wade Trappe

2 Lecture Overview Today’s lecture will focus on: –Point-Operations: These are operations that basically do not involve any explicit spatial memory –Examples: u Contrast stretching u Noise Clipping u Histogram Equalization Note: Most of this talk is borrowed from a lecture by my colleague Min Wu at UMD

3 Point Operations / Intensity Transform Basic idea –“Zero memory” operation u each output only depend on the input intensity at the point –Map a given gray or color level u to a new level v, i.e. v = f ( u ) –Doesn’t bring in new info. –But can improve visual appearance or make features easier to detect Example-1: Color coordinate transformations – RGB of each pixel  luminance + chrominance components  etc. Example-2: Scalar quantization – quantize pixel luminance/color with fewer bits input gray level u output gray level v

4 Gamma Characteristics & Gamma Correction Non-linearity in CRT display –Voltage U vs. Displayed luminance L’ u L’ ~ U  where  = 2.0 ~ 2.5 Use preprocessing to compensate  -distortion –U ~ L 1/  –log(L) gives similar compensation curve to  - correction u good for many practical applications –Camera may have L 1/  c capturing distortion with  c = 1.0-1.7 Power-law transformations are also useful for general purpose contrast manipulation U L’ L’ = a U  L U ~ logL ~ L 1/ 

5 Typical Types of Gray-level Transformation Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

6 Example: Negative Transformation Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

7 Example: Log Transformation Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

8 Example: Effects of Different Gammas ( “vectors” sample image from Matlab ) L 0 2.2 L 0 1/2.2 L0L0

9 Luminance Histogram Represents the relative frequency of occurrence of the various gray levels in the image –For each gray level, count the # of pixels having that level –Can group nearby levels to form a big bin & count #pixels in it ( From Matlab Image Toolbox Guide Fig.10-4 )

10 Luminance Histogram (cont’d) Interpretation –Treat pixel values as i.i.d random variables –Histogram is an estimate of the probability distribution of the r.v. “Unbalanced” histogram doesn’t fully utilize the dynamic range –Low contrast image ~ histogram concentrating in a narrow luminance range –Under-exposed image ~ histogram concentrating on the dark side –Over-exposed image ~ histogram concentrating on the bright side Balanced histogram gives more pleasant look and reveals rich content

11 Example: Balanced and Unbalanced Histograms Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

12 Image with Unbalanced Histogram ( From Matlab Image Toolbox Guide Fig.10-10 & 10-11 )

13 Contrast Stretching for Low-Contrast Images Stretch the over-concentrated graylevels in histogram via a nonlinear mapping –Piece-wise linear stretching function –Assign slopes of the stretching region to be greater than 1 input gray level u output gray level v a b o   

14 Contrast Stretching: Example original stretched

15 Clipping & Thresholding Clipping –Special case of contrast stretching with  =  = 0 –Useful for noise reduction when interested signal mostly lie in range [a,b] Thresholding –Special case of clipping with a = b = T –Useful for binarization of scanned binary images u documents, signatures, fingerprints input gray level u output gray level v a b o  input gray level u output gray level v T o

16 Examples of Histogram Equalization ( From Matlab Image Toolbox Guide Fig.10-10 & 10-11 )

17 Equalization Example (cont’d) original equalized

18 Histogram Equalization Goal: Map the luminance of each pixel to a new value such that the output image has approximately uniform distribution of gray levels To find what mapping to use: first model pixels as i.i.d. r.v. –How to generate r.v. with desired distribution?  Match c.d.f Want to transform one r.v. with certain p.d.f. to a new r.v. with uniform p.d.f. –For r.v. U with continuous p.d.f. over [0,1], construct a new r.v. V by a monotonically increasing mapping v(u) such that –Can show V is uniformly distributed over [0,1]  F V (v) = v u F V (v) = P(V  v) = P( F U (u)  v) = P( U  F -1 U (v) ) = F U ( F -1 U (v) ) = v –For u in discrete prob. distribution, the output v will be approximately uniform

19 How to Do Histogram Equalization? Approach: map input luminance u to the corresponding v –v will be approximately uniform for u with discrete prob. distribution u b/c all pixels in one bin are mapped to a new bin (no splitting) gray level u c.d.f P(U<=u) u0 o 1 255 F u0   gray level v c.d.f P(V<=v) v0 o 1 255 F u0  

20 Histogram Equalization Algorithm v  [0,1] Map discrete v  [0,1] to v’  {0,…,L-1} v min is the smallest positive value of v v min  0 1  L-1 Uniform quantization uvv’ p U (x i )

21 Histogram Equalization: A Mini-Example –xi 0 1 2 3 4 5 6 7 (L=8) –p(xi) 0.1 0.2 0.4 0.15 0.1 0.05 0 0 –v 0.1 0.3 0.7 0.85 0.95 1.0 1.0 1.0 –v’ 0 [1.5] [4.7] [5.8] [6.6] 7 7 7 (L-1)/(1-v min ) = 7.78 0 2 5 6 7 7 7 7

22 Summary: Contrast Stretching vs. Histogram Eq. What are in common? What are different? input gray level u output gray level v a b o    gray level u c.d.f P(U<=u) u0 o 1 255 F u0   gray level v c.d.f P(V<=v) v0 o 1 255 F u0  

23 Generalization of Histogram Equalization Histogram specification –Want output v with specified p.d.f. p V (v) –Use uniformly distributed r.v. W as an intermediate step u W = F U (u) = F V (v)  V = F -1 V (F U (u) ) –Approximation in the intermediate step needed for discrete r.v. u W1 = F U (u), W2 = F V (v)  take v s.t. its w2 is equal to or just above w1 Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

24 Generalization of Histogram Equalization Histogram modification –u  v = f(u)  v’ = unif.-quantized v –f(u) = u 1/2 or f(u) = u 1/3 –f(u) = log(1+|u|) ~ range compression (good for spectrum visualization) Histogram specification –Want output v with specified p.d.f. p V (v) –Use uniformly distributed r.v. W as an intermediate step u W = F U (u) = F V (v)  V = F -1 V (F U (u) ) –Approximation in the intermediate step needed for discrete r.v. u W1 = F U (u), W2 = F V (v)  take v s.t. its w2 is equal to or just above w1 Uniform quant. uv v’ f(u)

25 For Next Time… Next time we will focus on quantization


Download ppt "Image (and Video) Coding and Processing Lecture 5: Point Operations Wade Trappe."

Similar presentations


Ads by Google