image (and video) coding and processing lecture 5: point operations wade trappe

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

Upload: geraldine-stewart

Post on 17-Dec-2015

229 views

Category:

Documents


0 download

TRANSCRIPT

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

Image (and Video) Coding and Image (and Video) Coding and ProcessingProcessing

Lecture 5: Point OperationsLecture 5: Point Operations

Wade Trappe

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

Lecture OverviewLecture Overview

Today’s lecture will focus on:– Point-Operations: These are operations that basically do not

involve any explicit spatial memory

– Examples: Contrast stretching Noise Clipping Histogram Equalization

Note: Most of this talk is borrowed from a lecture by my colleague Min Wu at UMD

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

Point Operations / Intensity TransformPoint Operations / Intensity Transform Basic idea

– “Zero memory” operation 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

outp

ut g

ray

leve

l

v

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

Gamma Characteristics & Gamma Gamma Characteristics & Gamma CorrectionCorrection

Non-linearity in CRT display– Voltage U vs. Displayed luminance L’

L’ ~ U where = 2.0 ~ 2.5

Use preprocessing to compensate -distortion– U ~ L 1/

– log(L) gives similar compensation curve to -correction

good for many practical applications

– Camera may have L1/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

~ L1/

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

Typical Types of Gray-level TransformationTypical Types of Gray-level Transformation

Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

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

Example: Negative TransformationExample: Negative Transformation

Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

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

Example: Log TransformationExample: Log Transformation

Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

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

Example: Effects of Different GammasExample: Effects of Different Gammas

( “vectors” sample image from Matlab )

L02.2 L0

1/2.2

L0

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

Luminance HistogramLuminance 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 )

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

Luminance Histogram (cont’d)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

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

Example: Balanced and Unbalanced Example: Balanced and Unbalanced Histograms Histograms

Figure is from slides at Gonzalez/ Woods DIP book website (Chapter 3)

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

Contrast Stretching for Low-Contrast Contrast Stretching for Low-Contrast ImagesImages

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

outp

ut g

ray

leve

lv

a bo

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

Contrast Stretching: ExampleContrast Stretching: Example

original

stretched

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

Clipping & ThresholdingClipping & 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

documents, signatures, fingerprints

input gray level u

outp

ut g

ray

leve

l

v

a bo

input gray level u

outp

ut g

ray

leve

l

v

To

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

Examples of Histogram EqualizationExamples of Histogram Equalization( From Matlab Image

Toolbox Guide Fig.10-10 & 10-11 )

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

Equalization Example (cont’d)Equalization Example (cont’d)

original

equalized

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

Histogram EqualizationHistogram 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] FV(v) = v

FV(v) = P(V v) = P( FU(u) v)

= P( U F-1U(v) ) = FU( F-1

U(v) ) = v

– For u in discrete prob. distribution, the output v will be approximately uniform

u

UU dxxpuUPuFv0

)(][)(

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

How to Do Histogram Equalization?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

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

Fu0

gray level vc.

d.f

P(V<=v)

v0

o

1

255

Fu0

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

Histogram Equalization AlgorithmHistogram Equalization Algorithm

1-L ..., 0, ifor )(

)()( 1

0

L

ii

iiU

xh

xhxp

ux

iU

i

xpv )(

)1(1

'min

min Lv

vvRoundv

v [0,1]

• Map discrete v [0,1] to v’ {0,…,L-1}• vmin is the smallest positive value of v• vmin 0 1 L-1

ux

iU

i

xpv )( Uniform quantization

u v v’

pU(xi)

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

Histogram Equalization: A Mini-ExampleHistogram 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-vmin) = 7.78

0 2 5 6 7 7 7 7

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

Summary: Contrast Stretching vs. Histogram Summary: Contrast Stretching vs. Histogram Eq.Eq.

What are in common?

What are different?

input gray level u

outp

ut g

ray

leve

l

v

a bo

gray level u

c.d.

f

P(U<=u)

u0

o

1

255

Fu0

gray level v

c.d.

f

P(V<=v)

v0

o

1

255

Fu0

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

Generalization of Histogram EqualizationGeneralization of Histogram Equalization

Histogram specification– Want output v with specified p.d.f. pV(v)

– Use uniformly distributed r.v. W as an intermediate step

W = FU(u) = FV(v) V = F-1V

(FU(u) )

– Approximation in the intermediate step needed for discrete r.v.

W1 = FU(u) , W2 = FV(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)

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

For Next Time…For Next Time…

Next time we will focus on quantization