27
EECS490: Digital Image Processing Lecture #14 Color Gradient & Color Edges Noise in Color Images Image Degradation & Restoration • Noise Noise Filters - mean, -trimmed mean, ordering, contraharmonic

Lecture #14 - Case Western Reserve University

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Lecture #14

• Color Gradient & Color Edges

• Noise in Color Images

• Image Degradation & Restoration

• Noise

• Noise Filters - mean, -trimmed mean,

ordering, contraharmonic

Page 2: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

© 2002 R. C. Gonzalez & R. E. Woods

Color Edges

Color edges aligned

Color edges NOTaligned

RED GREEN BLUE COLOR

If we simplyadded themagnitudes ofthe gradientsthey would bethe same at thecenter.Intuitively theycannot be thesame.

Page 3: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

© 2002 R. C. Gonzalez & R. E. Woods

(Vector) Color Gradient

The maximum rate of change of a color vector c(x,y) at

(x,y) is given by

in the direction

NOTE: This expression gives two directions. One is the direction

of the maximum of F; the other is the direction of the minimum.

F ( ) =1

2gxx + gyy( ) + gxx gyy( )cos2 + 2gxy sin2

x, y( ) =1

2Tan 1 2gxy

gxx gyy

S.D.Zenzo, “A Note on the Gradient of a Multi-Image,” Computer Vision, Graphicsand Image Processing, Vol. 33, pp.116-125, 1986.

See Section 6.6 and p. 563-564 of GWE. Implemented as colorgrad.

Page 4: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

© 2002 R. C. Gonzalez & R. E. Woods

(Vector) Color Gradient

Let be the unit vectors along the RGB axes of a

RGB color space. Define

Further define

u =R

xr +

G

xg +

B

xb

v =R

yr +

G

yg +

B

yb

gxx = uiu = uTu =R

x

2

+G

x

2

+B

x

2

gyy = viv = vT v =

R

y

2

+G

y

2

+B

y

2

gxy = uiv = uTv =R

x

R

y+

G

x

G

y+

B

x

B

y

r, g, b

Page 5: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

© 2002 R. C. Gonzalez & R. E. Woods

Color Edges

Original image

Vector color gradient

Compute gradient ineach color image andadd together.

Difference betweengradient images.

Page 6: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

© 2002 R. C. Gonzalez & R. E. Woods

Color Edges

Page 7: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

© 2002 R. C. Gonzalez & R. E. Woods

Noise in RGB Color ImageAdditive Gaussian noise (mean=0, variance=800) in EACH color component

Noisy RED

Noisy BLUE

Noisy GREEN

Noisy RGB image

Page 8: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

© 2002 R. C. Gonzalez & R. E. Woods

Noise in HSI Color Image

I looks clean since1/3*(R+G+B) averagesnoise

Significantly degraded due to non-linearity ofcosine and min in HSI transformations

Page 9: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

© 2002 R. C. Gonzalez & R. E. Woods

Noise in Color Image

RGB image withsalt&pepper noise ingreen component

HUE

SATURATION INTENSITY

Noise spreads to allHSI components.

Page 10: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

© 2002 R. C. Gonzalez & R. E. Woods

Noise in Compression

Original image

Original image compressed anddecompressed using JPEG 2000.Slight blurring due to lossinherent in compressiontechnique.

JPEG 2000 uses a colortransformation similar to thatused by the Y’CbCr (luminance-blue chroma-red chroma) colorTV standard and waveletcompression.

Page 11: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

© 2002 R. C. Gonzalez & R. E. Woods 1999-2007 by Richard Alan Peters II

Page 12: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Image Restoration

© 2002 R. C. Gonzalez & R. E. Woods

Limits us tocertain types ofdegradation

Additive noise

g x, y( ) = h x, y( ) f x, y( ) + x, y( )

G u,v( ) = H u,v( )F u,v( ) + N u,v( )

Page 13: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Noise PDFs

© 2002 R. C. Gonzalez & R. E. Woods

Used forskewedhistograms

Page 14: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Noise PDFs

© 2002 R. C. Gonzalez & R. E. Woods

Gaussian

p z( ) =1

2e

z μ( )2

2 2

p z( ) =2

bz a( )e

z a( )2

b z a

0 z < a

p z( ) =

abzb+1

b 1( )!z a( )e az z 0

0 z < 0

Rayleigh Gamma

Exponential

p z( ) =1

b aa z b

0 otherwise

p z( ) =

pa z = a

pb z = b

0 otherwise

Uniform(white)

Impulse(salt & pepper)

p z( ) =ae az z 0

0 z < 0

Page 15: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Test Image

© 2002 R. C. Gonzalez & R. E. Woods

Page 16: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Noisy Images

© 2002 R. C. Gonzalez & R. E. Woods

Usually hard to identify type of noise in spatial domain

Test Image + Noise

pdf

Noise spectra adjusted so they just overlap

Page 17: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Noisy Images

© 2002 R. C. Gonzalez & R. E. Woods

Test Image + Noise

pdf

Page 18: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Noisy Images

© 2002 R. C. Gonzalez & R. E. Woods

Note regular pattern ofnoise in image.

Page 19: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Noise Characterization

© 2002 R. C. Gonzalez & R. E. Woods

Compute mean and variance for histograms and relate them to distribution parameters.

μz = zi p zi( )zi

z = zi μz( )2p zi( )

zi

zi is the gray level and p(zi) is the histogram

Test strips

Page 20: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Mean Filters

© 2002 R. C. Gonzalez & R. E. Woods

f x, y( ) =1

mng s,t( )

(s,t ) Sxy

f x, y( ) = g s,t( )1

mn

(s,t ) Sxy

Arithmetic mean filter Geometric mean filter

Geometric mean filtergives smoothingcomparable toarithmetic mean filterwithout losing as muchdetail.

Original image Image + Gaussian noise

Page 21: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Contraharmonic Filters

© 2002 R. C. Gonzalez & R. E. Woods

f x, y( ) =

g s,t( )Q+1

(s,t ) Sxy

g s,t( )Q

(s,t ) Sxy

Contraharmonic(Q=1.5)eliminates pepper noise

Contraharmonic(Q=-1.5)eliminates saltnoise

Contraharmonic filterreduces to arithmeticmean filter if Q=1

Pepper noise(random 0’s)

Salt noise(random 1’s)

Contraharmonic filter can reduce salt or pepper noise but not both at the same time.

Page 22: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Contraharmonic Filters

© 2002 R. C. Gonzalez & R. E. Woods

Using the wrong sign in a contraharmonic filter will significantly degrade the image.

Page 23: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Order Statistics Filter

© 2002 R. C. Gonzalez & R. E. Woods

Order statistics filters are

based upon ordering

(ranking) pixels in a

neighborhood.

The median filter selects the

middle element in the list.

f x, y( ) = median(s,t ) Sxy

g s,t( ){ }

Page 24: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Order Statistics Filters

© 2002 R. C. Gonzalez & R. E. Woods

Other order statistics filters

Median works best for impulse

noise.

Max works best for finding

bright points.

Min works best for finding dark

points.

Midpoint works best for

Gaussian or uniform noise

f x, y( ) = median(s,t ) Sxy

g s,t( ){ }

f x, y( ) = max(s,t ) Sxy

g s,t( ){ }

f x, y( ) = min(s,t ) Sxy

g s,t( ){ }

f x, y( ) =1

2min(s,t ) Sxy

g s,t( ){ } + max(s,t ) Sxy

g s,t( ){ }

Page 25: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Image Restoration

© 2002 R. C. Gonzalez & R. E. Woods

Max filter Min filter

Max and min filters do a reasonable job of removing impulsive noise but:• Max filter removed dark pixels from the borders of dark objects• Min filter removed light pixels from the borders of light objects

Notedifferencesbetween images

Page 26: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Yet Another Order Statistics Filter

© 2002 R. C. Gonzalez & R. E. Woods

Alpha-trimmed mean filter

removes the d/2 highest and

d/2 lowest intensity values.

The average of these

remaining mn-d values is

called an alpha-trimmed

mean filter.

f x, y( ) =1

mn dgr s,t( )

(s,t ) Sxy

Page 27: Lecture #14 - Case Western Reserve University

EECS490: Digital Image Processing

Image Restoration

© 2002 R. C. Gonzalez & R. E. Woods

Image+white noise

5x5arithmeticmeanfilter

Image+white noise+salt&peppernoise

5x5geometricmeanfilter

5x5medianfilter

5x5 alpha-trimmed(d=5) mean filter

Approaches performanceof median filter as dincreases but alsosmooths