UNIT 2 Image Enhancement in Spatial Domain and Frequency Domain - 2
UNIT 2 Image Enhancement in Spatial Domain and Frequency Domain - 2
By:
Dr. Hemant S. Goklani
ECE Department
IIIT, Surat
Histogram Specification
(Histogram Matching)
Goal
Derive a point operation, H(r), that maps the input
image into an output image that has the user-specified
histogram
z=H(r) = G-1(v=s=T(r))
AND
A or B
OR
Image subtraction
f:original(8 bits) h:4 sig. bits
Difference image
g(x,y)=f(x,y)-h(x,y)
scaling
difference image
Image subtraction: scaling the
difference image
g(x,y)=f(x,y)-h(x,y)
f and h are 8-bit => g(x,y) [-255, 255]
1. (1)+255 (2) divide by 2
• The result won’t cover [0,255]
2. (1)-min(g) (2) *255/max(g)
E g ( x, y) f ( x, y)
1 2
2
g ( x, y )
( x, y ) K 2
K
original Gaussian
noise
averaging averaging
K=8 K=16
averaging averaging
K=64 K=128
Local Enhancement
Normally, Transformation function based on the
content of an entire image
Some cases it is necessary to enhance details
over small areas in an image
The histogram processing techniques are easily
adaptable to local enhancement
Local Enhancement
K
1
g ( x, y )
K
g ( x, y )
i 1
i
Image Averaging (Gray Scale)
1 image
2 5 10 20
images images images images
Image Averaging (Color Image)
Average image
Spatial filtering
Basics of Spatial Filtering
•Mask, convolution
kernels
•Odd sizes
Spatial Filtering
Some neighbourhood operation between
neighbourhood of image pixel and corresponding
value of mask/filter/kernel/window that has the
same dimension as the neighbourhood.
Mask size is M x N and M=2a+1, N=2a+1.
Modification at border is handled by padding rows
and col. of ‘0’s or by replicating some rows and
columns.
Spatial Filtering
a b
g(x, y) w(s,t) f (x s, y t)
sa tb
Blurring vs Sharpening
Blurring/smooth is done in spatial domain by pixel
averaging in a neighbors, it is a process of integration
Electronic printing
Medical imaging
Industrial inspections and
Autonomous guidance in military systems
Derivative operator
The strength of the response of a derivative operator is
proportional to the degree of operator is proportional to the
degree of discontinuity of the image at the point at which the
operator is applied
Image differentiation
Enhances edges and other discontinuities (noise)
Gray level
profile f
x
δf
δx
x
Sharpening Spatial Filters
Foundation:
f
f ( x 1) f ( x)
x
2 f
f ( x 1) f ( x 1) 2 f ( x)
x 2
Observation
1st order derivative is nonzero along the entire ramp, while 2nd
order derivative is nonzero only at the onset and end of ramp.
1st order derivative produce thick edges and 2nd order
derivative much finer ones.
Response at isolated noise point is much stronger for 2nd order
derivative hence it can enhance fine details much more than
1st order derivative.
For step change 1st order derivative generally have a stronger
response.
2nd order derivative produces a double response to a gray level
step (-ve to +ve)
The second derivative is better suited than the first derivative
for image enhancement because of the ability of the former to
enhance fine detail.
THANK YOU