0% found this document useful (0 votes)
69 views49 pages

Image Enhancement: (C) 2002-2012 by Yu Hen Hu

This document discusses image enhancement techniques. It describes the goal of image enhancement as modifying an image to enhance its usefulness for a particular application. The document outlines several methods for image enhancement, including spatial domain techniques like pixel processing and spatial filtering, as well as frequency domain filtering. It provides examples of common image enhancement effects and techniques for pixel-level gray scale processing and histogram processing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views49 pages

Image Enhancement: (C) 2002-2012 by Yu Hen Hu

This document discusses image enhancement techniques. It describes the goal of image enhancement as modifying an image to enhance its usefulness for a particular application. The document outlines several methods for image enhancement, including spatial domain techniques like pixel processing and spatial filtering, as well as frequency domain filtering. It provides examples of common image enhancement effects and techniques for pixel-level gray scale processing and histogram processing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Image Enhancement

(C) 2002-2012 by Yu Hen Hu 1


Image Enhancement

• Goal: to modify an image • Methods:


so that its utilization on a – Spatial domain
particular application is • Pixel processing
enhanced. – Gray level transformation:
Data independent
• A set of ad hoc tools – histogram processing:
applicable based on Data-dependent
– Arithmetic ops
viewer’s specific needs. • Spatial filtering
• No general theory on – Frequency domain filtering
image enhancement
exists.

(C) 2002-2012 by Yu Hen Hu 2


Image Enhancement Effects

• Resizing, cropping
• Contrasts enhancement: sharpening & softening
• Edge enhancement
• Brightness adjustment, equalization
• Color adjustment, gamma correction
• Noise reduction/unwanted object removal
• Geometric adjustment, lens error correction
• Special enhancement techniques:
– Red eye removal
– Hand motion compensation, motion blur reduction

(C) 2002-2012 by Yu Hen Hu 3


Image Enhancement:
Pixel Gray Scale Processing
Gray-level Transforms
• Operated on individual pixel’s intensity values: s =
T(r). r: original intensity, s: new intensity
• Data independent pixel-based enhancement
method.
• Approaches
– Image negatives
– Log transform
– Power law transform
– Piece-wise linear transform

(C) 2002-2012 by Yu Hen Hu 5


Image Negatives

• s = T(r) = L-1-r
• Similar to photo
negatives.
• Suitable for
enhancing white or
gray details in dark
background.

(C) 2002-2012 by Yu Hen Hu 6


Log Gray-level Transform

• s = T(r) = c log(1+r) • expand dark value to enhance


details of dark area

(C) 2002-2012 by Yu Hen Hu 7


Power Law Gray-level Transform

• s = T(r) = c rg • Gamma correction: to compensate


the built-in power law compression
due to display characteristics.

(C) 2002-2012 by Yu Hen Hu 8


Piece-wise Linear Gray-level Transform

• Allow more control on the complexity of T(r).


– Contrast stretching
– Gray-level slicing
– Bit-plane slicing

(C) 2002-2012 by Yu Hen Hu 9


Contrast Stretching

(C) 2002-2012 by Yu Hen Hu 10


Gray-level Slicing

(C) 2002-2012 by Yu Hen Hu 11


Bit-Slicing

(C) 2002-2012 by Yu Hen Hu 12


Histogram Processing

• Data-dependent pixel-
based image enhancement
method.
• Histogram = PDF of image
pixels.
– Assumption: each image
pixel is drawn from the
same PDF independently
(i.i.d.)
– Several effects of
histograms are shown at the
right side.

(C) 2002-2012 by Yu Hen Hu 13


Histogram Equalization

• A gray-level transformation
method that forces the
transformed gray level to
spread over the entire
intensity range.
– Fully automatic,
– Data dependent,
– (usually) Contrast enhanced
• Usually, the discrete-valued
histogram equalization
algorithm does not yield exact
uniform distribution of r
histogram.
• In practice, one may prefer
s = T (r ) = ∫ p (w)dw
r

“histogram specification” w=0

⇒ ps ( s ) = 1, 0 ≤ s ≤ 1.

(C) 2002-2012 by Yu Hen Hu 14


Functions of Random Variables
Lemma 1. Let FR (r ) and FS ( s ) be the cdf of original
and transformed images respectively. Then for each
s T (r ), 0 ≤ r , s ≤ 1, FS ( s=
= ) Pr .{S ≤ s=} Pr .{R ≤ r=} FR ( r )
In orther words, fraction of pixels whose value R ≤ r
and fraction of pixels of transfored image whose values
S≤s=T ( r ) are the same.

(C) 2002-2012 by Yu Hen Hu 15


Histogram Equalization
An equalized histogram ⇒ ps ( s )= 1, 0 ≤ s ≤ 1.
0 s < 0;

Equivalently, FS =
( s )  s 0 ≤ s ≤ 1;
1 s > 1.

( r ) FS=
In other words, FR= ( s ) T=
(r ) s
r
=
Thus, ( r ) FR=
s T= (r ) ∫ pR ( w)dw
w=0

(C) 2002-2012 by Yu Hen Hu 16


Practical Considerations

• r, s ∈ {0, 1, …, L-1} instead of [0, 1].


⇒ integration is replaced by summation
• Assume # pixels in the image is N. # of pixels whose
gray scale value is nr. Then the mapping becomes
r
T (r ) = ∫ pR ( w)dw
w=0

 L −1 r 
⇒ s=  ∑
 N w=0 
nw = ( L − 1) ⋅ cdf ( r ) 

the bracket indicates rounding to nearest integer.

(C) 2002-2012 by Yu Hen Hu 17


Histogram Equalization Example

• Consider a 5 × 5 image with L = 4. 0 0 1 1 2


1 2 3 0 1 

r 0 1 2 3
3 3 2 2 0
p(r) 6/25 7/25 7/25 5/25  
Cdf(r) 6/25 13/25 20/25 25/25 2 3 1 0 0
s 1 2 2 3 1 1 3 2 2 

• Since original image already has an 1 1 2 2 2


equalized histogram, the effect is 2 2 3 1 2 

not clear in this example. 3 3 2 2 1
 
2 3 2 1 0
 2 2 3 2 2 
(C) 2002-2012 by Yu Hen Hu 18
More Practical Considerations

• The number of non-zero bins in the transformed


histogram is no larger than that of the original image.
• As such, the equalization process will
– Move some bins to other locations
– Combine two or more bins into one at perhaps a different
location

(C) 2002-2012 by Yu Hen Hu 19


Histogram Modification

• One may want to convert the histogram to a target


histogram that is not uniformly distributed. Rather with
a new pdf g(s).

( r ) FS=
In this case, one has FR= ( s ) T=
(r ) g (s)
 r

Thus, T ( r )= s= g ( FR ( r ) )= g  ∫ pR ( w)dw 
−1 −1

 w=0 
Assuming g −1 ( ) exists over [ 0 1].

(C) 2002-2012 by Yu Hen Hu 20


Histogram Matching

• Transform pdf of r to a desired pdf ps(s).


• A generalization of histogram equalization.
• Basic idea: Given pr(r) and desired pdf pz(z), find a
transform z = T(r), such that P(Z ≤ z) = P(R ≤ r).

(C) 2002-2012 by Yu Hen Hu 21


Indirect Method

• Indirect approach:
– First equalize the
histogram using
transform s = T(r).
– Equalize the desired
histogram v = G(z).
– Set v = s to obtain the
composite transform

z = G −1 (T (r ))

Fig. 3.19

(C) 2002-2012 by Yu Hen Hu 22


Histogram Matching Example

(C) 2002-2012 by Yu Hen Hu 23


Histogram for Local Enhancement

(C) 2002-2012 by Yu Hen Hu 24


Image subtraction

Mask mode radiography

(C) 2002-2012 by Yu Hen Hu 25


Image Averaging

• Same signal, but different


noise realization.
• Averaging of many such images
will enhance SNR.

(C) 2002-2012 by Yu Hen Hu 26


Image Enhancement:
Spatial Domain Filtering
Spatial Filtering

I J
g (m, n) = ∑ ∑ w(i, j ) f (m − i, n − j )
i =− I j =− J

• 2D FIR filtering
– Mask filtering:
convolution of the image
with a 2D mask
– Applications to image
enhancement: • Data-dependent
• Smoothing: low pass nonlinear filters
• Sharpening: high pass – Local histogram
– Order statistic filters
• Medium filter

(c) 2002-
2006 by Yu
Smoothing Linear Filters

I J

∑ ∑ w(i, j ) f (m − i, n − j )
i =− I j =− J
g (m, n) = I J

∑ ∑ w(i, j )
i =− I j =− J

Normalization of coefficient to ensure 0


≤ g(m,n) ≤ L-1

(c) 2002-
2006 by Yu
Sharpening Linear Filters

• High boosting filter: • Laplacian operator:

∂ 2 f ( x, y ) ∂ 2 f ( x, y )
∇ f ( x, y ) =
2
+
∂x 2 ∂y 2
= f ( x + 1, y ) + f ( x − 1, y ) + f ( x, y + 1) + f ( x, y − 1) − 4 f ( x, y )

– A≥1
• Derivative filter:
– Use derivatives to approximate
high pass filters. Usually 2nd
derivatives are preferred. The
most common one is the
Laplacian operator.

(c) 2002-
2006 by Yu
Laplacian Filter for Image Enhancement

 f ( x, y ) − ∇ 2 f ( x, y ) center of mask < 0;


g ( x, y ) = 
 f ( x, y ) + ∇ f ( x, y ) center of mask > 0.
2

(c) 2002-
2006 by Yu
Gradient filters

Roberts cross-gradient operator

Sobel operator

(c) 2002-
2006 by Yu
Local Statistic Filters

• Calculate a local statistics and • Medium filter


then replace the center pixel – Useful in removing impulsive
value with the calculated noise (salt-and-pepper noise)
statistics. without smoothing the rest of
the image.

(c) 2002-
2006 by Yu
Image Enhancement:
Frequency Domain Processing
Image and Its Fourier Spectrum

(C) 2002-2012 by Yu Hen Hu 35


Filtering in Frequency Domain: Basic Steps

Basic Steps
1. Multiply pixel f(x,y) of the
input image by (-1)x+y.
2. Compute F(u,v), using DFT
3. G(u,v)=F(u,v)H(u,v)
4. g1(x,y)=F-1{G(u,v)}
5. g(x,y) = g1(x,y)*(-1)x+y

(C) 2002-2012 by Yu Hen Hu 36


Notch Filter

0 u = v = 0
H (u , v) = 
1 otherwise.
• The frequency response
H(u,v) has a notch at
origin (u = v = 0).
• Effect: reduce mean
value.
• After post-processing
where gray level is
scaled, the mean value
of the displayed image
is no longer 0.

(C) 2002-2012 by Yu Hen Hu 37


Low-pass & High-pass Filtering

(C) 2002-2012 by Yu Hen Hu 38


Gaussian Filters

• Fourier Transform pair of


Gaussian function
 H (u ) = Ae − u / 2σ
2 2


h( x) = 2π ⋅ σ ⋅ Ae − 2π σ x
2 2 2

• Depicted in figures are


low-pass and high-pass
Gaussian filters, and their
spatial response, as well as
FIR masking filter
approximation.
• High pass Gaussian filter
can be constructed from
the difference of two
Gaussian low pass filters.

(C) 2002-2012 by Yu Hen Hu 39


Gaussian Low Pass Filters

 (D(u , v) )2 
H (u , v) = exp − 
2σ 2 
 
D(u,v): distance from the origin
of Fourier transform

(C) 2002-2012 by Yu Hen Hu 40


Ideal Low Pass Filters

• The cut-off frequency Do


determines % power are
filtered out.

• Image power as a function of distance


from the origin of DFT (5, 15, 30, 80,
230)
(C) 2002-2012 by Yu Hen Hu 41
Effects of Ideal Low Pass Filters

• Blurring can be modeled as the


convolution of a high resolution
(original) image with a low pass
filter.

(C) 2002-2012 by Yu Hen Hu 42


Ringing and Blurring

(C) 2002-2012 by Yu Hen Hu 43


Butterworth Low Pass Filters

1
H (u , v) =
1 + [D(u , v) / Do ]
2n

(C) 2002-2012 by Yu Hen Hu 44


High Pass Filters

• Ideal high pass filter

0 if D(u , v) ≤ Do
H (u , v) = 
1 otherwise.

• Butterworth high pass


filter
1
H (u , v) =
1 + [D0 / D(u , v)]
2n

• Gaussian high pass filter


 (D(u , v) )2 
H (u , v) = 1 − exp− 2 
 2 D 0 

(C) 2002-2012 by Yu Hen Hu 45


Applications of HPFs

• Ideal HPF
– Do = 15, 30, 80

• Butterworth HPF
– n = 2,
– Do = 15, 30, 80

• Gaussian HPF
– Do = 15, 30, 80

(C) 2002-2012 by Yu Hen Hu 46


Laplacian HPF

• 3D plots of the Laplacian


operator,
• its 2D images,
• spatial domain response
with center magnified,
and
• Compared to the FIR
mask approximation
∇ 2 f ( x, y ) ⇔
[ ]
− (u − M / 2 ) + (v − N / 2 ) ⋅ F (u , v)
2 2

(C) 2002-2012 by Yu Hen Hu 47


Properties of 2D DFT

(C) 2002-2012 by Yu Hen Hu 48


Properties of 2D DFT

(C) 2002-2012 by Yu Hen Hu 49

You might also like