image enhancement - washington state universitycs445/lecture_3.pdfimage enhancement • to process...
TRANSCRIPT
Image Enhancement
• To process an image so that output is “visually better” than the input, for a specific application.
• Enhancement is therefore, very much dependent on the
particular problem/image at hand. • Enhancement can be done in either:
� Spatial domain: operate on the original image
g(m,n) = T[f(m,n)]
� Frequency domain: operate on the DFT of the original image
G(u,v) = T[F(u,v)], where
F(u,v) = F[f(m,n)], and G(u,v) = F[g(m,n)],
Image Enhancement Techniques
Point Operations
Mask Operations
Transform Operations
Coloring Operations
• Image Negative
• Contrast Stretching
• Compression of dynamic range
• Graylevel slicing
• Image Subtraction
• Image Averaging
• Histogram operations
• Smoothing operations
• Median Filtering
• Sharpening operations
• Derivative operations
• Histogram operations
• Low pass filtering
• High pass Filtering
• Band pass filtering
• Homomorphic filtering
• Histogram operations
• False coloring
• Full color processing
Point Operations • Output pixel value g(m, n) at pixel (m, n) depends only on the
input pixel value at f(m, n) at (m, n) (and not on the neighboring pixel values).
• We normally write s = T(r), where s is the output pixel value
and r is the input pixel value.
• T is any increasing function that maps [0,1] into [0,1]. M atlab Aside:
• This is roughly what matlab does when you convert a ui nt 8 image to doubl e a = i mr ead( ’ i mage. t i f ’ ) ; b = i m2doubl e( a) ;
00 1
1
r
s
Input grayvalue (normalized)
Outut grayvalue (normalized)
• a is an uint8 array, with gravalues in [0, 255]. b is a double array, with gravalues in [0, 1] (obtained by linear scaling).
Image Negative
“Film Negative” Negative of “ film negative”
grayvalue max. : ,1)( LrLsrT −−==
0r
s
0
1−L
1−L
Contrast Stretching
• Increase the dynamic range of grayvalues in the input image. • Suppose you are interested in stretching the input intensity
values in the interval [r1, r2]:
• Note that (r1- r2) < (s1- s2). The grayvalues in the range [r1, r2]
is stretched into the range [s1, s2]. • Special cases:
� Thresholding or binar ization
r1 = r2 , s1 = 0 and s2 = 1
00 1
1
r
s
r1 r2
s1
s2
01 =s
• Useful when we are only interested in the shape of the objects
and on on their actual grayvalues.
0 r
s
r1 = r2
12 =s
Grayscale “Blood cell” image a = i mr ead( ’ i mage. t i f ’ )
Binary “Blood cell” image b = i m2bw( a, 0. 5)
• Gamma correction:
Output Image is “darker”
����
�
����
�
�
>
≤≤�������
−−
<
=
==
2
2112
1
21
,1
r ,
,0
and ,1 ,0
1
rr
rrrr
rr
rr
T(r)
ss
g
0r
s
r1
s1 = 0
s2 =1
r2 1
g > 1
0r
s
r1
s1 = 0
s2 =1
r2 1
g < 1
Output Image is “brighter”
• Example:
Grayscale Photograph a = i mr ead( ’ i mage. t i f ’ )
Contrast enhanced photograph b=i madj ust ( a, [ 0. 3, 0. 7] ,[ 0, 1] , 0. 7)
Compression of Dynamic Range
• When the dynamic range of the input grayvalues is large compared to that of the display, we need to “compress” the grayvalue range --- example: Fourier transform magnitude.
• Typically we use a log scale.
)1log()( rcrTs +==
Saturn Image Mag. Spectrum Mag. Spectrum in log scale
• Graylevel Slicing: Highlight a specific range of grayvalues. •
• Example:
Original Image
r
s
r
s
Without background With background
Highlighted Image (no background)
Highlighted Image (with background)
• Bitplane Slicing: Display the different bits as individual binary images.
8 bitplanes of cameraman image
Image Subtraction
• In this case, the difference between two “similar” images is computed to highlight or enhance the differences between them:
• It has applications in image segmentation and enhancement
),(),(),( 21 nmfnmfnmg −=
Example: Mask mode radiography
f1(m, n): Image before dye injection g(m, n): Image after dye injection, followed by subtraction f2(m, n): Image after dye injection
Image Averaging for noise reduction
• Noise is any random (unpredictable) phenomenon that contaminates an image.
• Noise is inherent in most practical systems:
� Image acquisition � Image transmission � Image recording
• Noise is typically modeled as an additive process:
• The noise η (m, n) at each pixel (m, n) is modeled as a
random variable. • Usually, η (m, n) has zero-mean and the noise values at
different pixels are uncorrelated. • Suppose we have M observations { gi(m, n)} , i=1, 2, …, M,
we can (partially) mitigate the effect of noise by “averaging”
),(),(),( nmnmfnmg η+=
Noisy Image Noise-free Image
Noise
∑=
=M
ii nmg
Mnmg
1
),(1
),(
• In this case, we can show that
• Therefore, as the number of observations increases ( ∞→M ),
the effect of noise tends to zero.
)],([Var1
)],([Var
),()],([
nmM
nmg
nmfnmgE
η=
=
Image Averaging Example
Noise-free Image
Noisy Image Noise Variance = 0.05
M =2 M =5 M =10
M =25 M =50 M =100