Download as pdf or txt
Download as pdf or txt
You are on page 1of 49

Computer Vision and Image Processing

– Fundamentals and Applications

Image Enhancement

n
ya
hu
.B
.K
M

Course Instructor: Dr. M.K. Bhuyan


Professor

Department of Electronics and Electrical Engineering,


Indian Institute of Technology Guwahati, India.
M
.K
.B
hu
ya
n
Image Enhancement
Aimed at improving the quality of an image
for better human perception or better
interpretation by machines.

n
ya
hu
.B
.K
M
Image enhancement

Input image Better image


Enhancement
technique

n
ya
hu
.B
• Application specific
.K
M
• No general theory
• Can be done in
-Spatial domain: Manipulate pixel intensity directly
- Frequency domain: Modify the Fourier transform
Includes both spatial- and frequency-domain techniques:

• Point Operation
• Spatial Operation
• Frequency domain operations
• Pseudo Colouring

n
ya
hu
.B
.K
M
Spatial Domain technique

g[ x, y ] = T ( f [x, y ])
or
s = T ( r)

n
ya
hu
.B
.K
M

-Simplest case

• g[.] depends only on the value of f at [ x, y]; does not depend on the
position of the pixel in the image.
• brightness transform or point processing
M
.K
.B
hu
ya
n
Intensity Transformation
Functions

n
ya
hu
.B
.K
M
s = T (r ) s = T (r )

n
ya
hu
.B
.K
M

Contrast Stretching Thresholding


function
Thresholding
If I [ m, n]  Th
I [ m, n] = 255
else
I [ m, n ] = 0

n
ya
hu
.B
.K
M

Th=
120
M
.K
.B
hu
ya
n
Log transformation

• Compresses the dynamic range


s = c log( r + 1)

where c is the scaling factor.

n
ya
hu
.B
.K
M
Example : Used to display the 2D Fourier Spectrum
Some useful transformations

n
ya
hu
.B
.K
M
Log transformation (Contd..)

n
ya
hu
.B
.K
M
M
.K
.B
hu
ya
n
Power law transformation

• Expands dynamic range s = cr
where  and c are positive constants
• Often referred to as gamma-correction

n
ya
hu
.B
.K
M
Example :  = 1, Image scaling, same effect as adjusting
camera exposure time.
Some useful transformations

n
ya
hu
.B
.K
M
Example: Image Display in the monitor

n
ya
Monitor output

hu
Sample Input to Monitor

.B
.K
M
Gamma Correction

Sample Input

n
ya
hu
.B
.K
Gamma Corrected Input
M

Monitor Output
Gamma corrected image

n
ya
hu
.B
.K
M
Original Image Corrected by  = 1.5
Gamma correction (Contd..)

n
ya
hu
.B
.K
M
Piecewise Linear Intensity
Transformation Function

n
ya
hu
.B
.K
M
M
.K
.B
hu
ya
n
s = T (r )

r Enhanced in the
range 100-150 and
150-255

n
ya
hu
.B
.K
M
M
.K
.B
hu
ya
n
n
ya
hu
.B
.K
M
Results of slicing in the black and white regions
Bit-plane slicing
• Highlights the contribution of specific bits to image intensity
• Analyses relative importance of each bit; aids determining the
number of quantization levels for each pixel

n
ya
hu
.B
.K
M
MSB plane

n
ya
hu
.B
.K
M

MSB plane obtained by


Original
thresholding at 128
M
.K
.B
hu
ya
n
Histogram Processing

• Histogram
• Histogram equalization
• Histogram specification

n
ya
hu
.B
.K
M
Histogram
rk  {0,1,.., L − 1}
nk
p(rk ) =
n
nk → Number of pixels with
gray level rk

n
ya
hu
n → Total number of pixels
.B
.K
M
histogram:
For B-bit image, initialize 2B bins with 0
For each pixel x,y
If f(x,y)=i, increment bin with index I
endif
endfor
M
.K
.B
hu
ya
n
Histogram
M
.K
.B
hu
ya
n
M
.K
.B
hu
ya
n
n
ya
hu
.B
.K
M

Low-contrast image Histogram


n
ya
hu
.B
.K
M

Improved-contrast image Histogram


Histogram Equalization

s = T (r ) 0  r  L-1
Assumptions
(a) s = T (r ) is a montonically increasing function in the interval

n
ya
0  r  L-1

hu
.B
.K
M
(b) 0  T (r )  L − 1 for 0  r  L − 1

(c) r = T −1 ( s),
T (r ) is a strictly monotonically increasing function in the interval
0  r  L −1
Histogram Equalization (contd.)

r can be treated as a random variable in 0, 1 with pdf


pr ( r ) .The pdf of s = T ( r ) is

pr ( r )
ps ( s ) =
ds
dr r =T −1 ( s )

n
ya
hu
.B
.K
M
r
Suppose s=T ( r ) =  pr ( u ) du ,0  r  1
0

ds
then, = pr ( r )
dr

pr ( r )
 ps ( s ) = = 1, 0  s  1
pr ( r )
Histogram Equalization

rk  {0,1,.., L − 1}
nk
p(rk ) =
n

n
k

ya
g k =  p(ri )

hu
.B
.K
M
i =0

The resulting gk needs to be scaled and rounded.


n
ya
hu
.B
.K
M

Histogram-equalized image image Histogram


Histogram-equalized Image

n
ya
hu
.B
.K
M
M
.K
.B
hu
ya
n
Histogram specification

Given an image with a particular histogram, another image


which has a specified histogram can be generated and this process
is called histogram specification or histogram matching.
pr ( r ) → original histogram
pz ( z ) → desired histogram

n
ya
s =  pr ( u ) du

hu
.B
.K
M
0
z
r =  pz ( w ) dw
0
z = G −1 ( s ) = G −1T ( r )
M
.K
.B
hu
ya
n
M
.K
.B
hu
ya
n
M
.K
.B
hu
ya
n
M
.K
.B
hu
ya
n
M
.K
.B
hu
ya
n
M
.K
.B
hu
ya
n

You might also like