Professional Documents
Culture Documents
Introduction
Image Enhancement : A technique for enhancing/improving visual quality of an
image
2
Image Enhancement
g ( x, y ) T > f ( x, y ) @
f(x,y) : input image
Size of neighborhood: f(x,y)
g(x,y) : output image
T : operator defined over (1 x 1) – point operation
some neighborhood (m x m) – window/mask operation
3
Contrast Stretching
¾ To increase the dynamic range of the input image
L-1 L-1
Output intensity
Output intensity
Limiting case
0, 0 L-1 0, 0
Input intensity Input intensity L-1
L-1
Thresholding
Output intensity
Piece-wise contrast
stretching
Assumption:
Image gray levels : 0 to (L-1)
4
Basic Gray Level Transformation
Basic relation between input and output pixel intensity is
5
Basic Gray Level Transformation
Negative : enhancing white details
on black background (x-ray images)
s L 1 r
s c log(1 r )
Fourier spectrum
6
Basic Gray Level Transformation
Negative : enhancing white details
on black background (x-ray images)
s L 1 r
s c log(1 r )
Fourier spectrum
7
Basic Gray Level Transformation
s cr J
Gamma correction:
CRT devices (power law): 1.8-2.5
MRI of fractured human spine (γ=0.3)
8
Gray-level Slicing
• Highlighting a specific
range of gray level in an
image
9
Histogram Processing
• Modify the input image histogram to improve the contrast.
• Used for Contrast stretching in images with narrow histogram.
• Automatically developed transformation function based on input image histogram.
10
Histogram Equalization
Assumption:
Image pixel intensity : rk, k=0, 1, 2, …… , L-1
Image histogram : h(rk)=nk
Normalized histogram : p(rk)=h(rk)/(M.N)
k
T (rk ) (L 1)¦ p(rj )
j 0
11
12
0 7 3 2 3
0 0 0 6 7
7 7 2 2 0
1 1 0 4 1
0 0 7 4 1
r p T level
0 8/25 56/25 2
1 4/25 84/25 3
2 3/25 105/25 4
3 2/25 119/25 5
4 2/25 133/25 5
5 0 133/25 5
6 1/25 140/25 6
7 5/25 175/25 7
13
r n1 s n2
0 8 0 0
1 4 1 0
2 3 2 8
3 2 3 4
4 2 4 3
5 0 5 4
6 1 6 1
7 5 7 5
Chart Title
Chart Title 10
10 8
8 6
6
4
4
2 2
0 0
0 2 4 6 8 10 0 2 4 6 8 10
14
Example:
Suppose, 2-bit image (L=4) of size 5 x 4 pixels
rk nk p(rk) T(rk)
No. of pixels
0 4 0.2 0.6→1
1 10 0.5 2.1→2
2 4 0.2 2.7→3
3 2 0.1 3
Input intensity
Equalized histogram: rk nk
0 0
1 4
No. of pixels
2 10
3 6
Input intensity
15
Examples:
Image Subtraction
Used for object/motion tracking, image comparison.
Applications: imaging of blood vessels, security system etc.
16
Image Averaging
A noisy image is
g ( x, y ) f ( x, y ) K ( x, y ) uncorrelated, zero mean noise
Noise reduction by image averaging, M
1
g ( x, y )
M
¦ g ( x, y )
i 1
i
a) b) c) d)
17
Spatial Filtering
y
0,0
• Convolution with the spatial mask of the filter (x,y)
• Computed based on neighborhood values and by
moving the mask from point to point w(s,t)
a b
g ( x, y ) ¦ ¦ w(s, t ) f (x s, y t),
s a t b
a (m 1) 2, b (n 1) 2
18
Image Smoothing
3 x 3 simple averaging filter 3 x 3weighted averaging filter
ª1 1 1º ª1 2 1 º
1« » 1 « »
w 1 1 1 w 2 4 2
9« » 16 « »
«¬1 1 1»¼ «¬1 2 1 »¼
19
Effect of image smoothing with
different mask size
20
Order Statistics Filters
Non-linear filters:
¾ Median filter : removal of salt and pepper noise, impulse noise
¾ Max filter : finding the brightest point in a neighborhood
¾ Min filter : finding the darkest point in a neighborhood
Example:
21
Image Sharpening
¾ Used to highlight fine details of an image.
¾ Applications : electronic printing, medical imaging, industrial inspection,
autonomous guidance in military systems etc.
Derivative filter
• Enhances edges and other discontinuities (like noise)
• Deemphasizes area with slowly varying intensities
• Zero response at uniform region, non-zero response at the onset of change of
intensity
• 1st order and 2nd order derivatives can be used
22
First order derivative: non zero response at the onset of step or ramp, along
ramp; zero response in flat segments
Second order derivative: zero response in flat segments and along ramp of
constant slope; non zero response at the onset and end of step or ramp,
23
߲݂
ൌ ݂ ݔ ͳ െ ݂ሺݔሻ
߲ݔ
߲ଶ݂
ൌ ݂ ݔ ͳ ݂ሺ ݔെ ͳሻ െ ʹ݂ሺݔሻ
߲ ݔଶ
First order derivative: stronger response to gray level step, produces thicker edges
Second order derivative: stronger response to fine details (thin lines, isolated points),
double response at step changes
24
Laplacian Filter
w2 f w2 f
• Simplest, isotropic derivative operator f 2
wx 2 wy 2
w2 f ª1 1 1º
f ( x 1, y ) f(x 1, y) 2 f ( x, y )
wx 2 w ««1 8 1»»
w2 f
f ( x, y 1) f(x, y 1) 2 f ( x, y ) «¬1 1 1»¼
wy 2
2 f f ( x 1, y ) f(x 1, y) f ( x, y 1) f(x, y 1) 4 f ( x, y )
g ( x, y ) f ( x, y ) 2 f ( x, y )
25
Considering four neighbours, Can be written as
ª0 1 0 º ª 0 1 0º
w ««1 4 1 »» w «« 1 4 1 »»
«¬0 1 0 »¼ «¬ 0 1 0 »¼
ª 0 1 0º ª 1 1 1º
w «« 1 5 1 »» w «« 1 9 1 »»
«¬ 0 1 0 »¼ «¬ 1 1 1»¼
26
Unsharp Masking
Subtract a blurred version of the image from the image itself.
ª wf º
ª Gx º « wx »
f «G » « » mag (f ) [Gx2 G y2 ]1 2
¬ y¼ « wf »
«¬ wy »¼ z1 z2 z3
z4 z5 z6
For 2x2, simplest derivative: Gx:(z8-z5) and Gy: (z6-z5)
For 3x3, |(z7+z8+z9)-(z1+z2+z3)| and |(z3+z6+z9)-(z1+z4+z7)| z7 z8 z9
ª 1 0 º ª0 1º
Gx « 0 1 » , Gy «1 0 »
¬ ¼ ¬ ¼
28
Sobel operator
ª 1 2 1º ª 1 0 1 º
Gx « 0 0 0 », G « 2 0 2 »
« » y « »
«¬ 1 2 1 »¼ «¬ 1 0 1 »¼
29
Combining Spatial Methods
Depending on specific goal, single method or combination of several methods
is used.
Examples: Enhancement using Laplacian filter Smoothing Laplacian
filter filter
Whole body scan ( bone infection and
tumor detection)
30
Mask and its size
ª0 0 0 º ª1 1 1º ª0 0 0 º
«0 1 0 » 1« » «0 0 1 »
1 1 1
« » 9« » « »
«¬0 0 0 »¼ «¬1 1 1»¼ «¬0 0 0 »¼
Identity average
ª1 1 2 2 2 1 1º
Gaussian filter: r=3σ (99%) «1 2 2 4 2 2 1 »»
«
or h=w=5σ (98.76%) «2 2 4 8 4 2 2»
« »
«2 4 8 16 8 4 2 »
«2 2 4 8 4 2 2»
« »
V 1.4 «1 2 2 4 2 2 1»
«1 2 2 2 1 1 »¼
¬ 1
31
Filtering operation
32
1. An 8-bit input monochrome image is to be enhanced by stretching
graylevel range [86, 124] by a factor 2. The remaining parts of the grayscale
should be compressed at a uniform rate. Derive the gray level
transformation function for the purpose and draw the curve.
2. compute the High-boost filtered image. Consider 3x3 mask, zero padding,
A=1.7 and 4-neighbour Laplacian filter for unsharp masking.
18 20 19 19
21 20 7 18
20 22 21 17
22 4 20 25
33