Professional Documents
Culture Documents
Introduction
Two Groups of Enhancement Techniques:
Acquisition
Enhancement
Segmentation
Postprocessing
Feature extraction
Recognition
9/4/2013
Background g
Notation:
g(x,y y) =T [ f(x,y y) ]
y (x,y)
where: f(x,y) is the input image, g(x,y) is the output image, and T is an operator defined over a neighborhood of (x,y).
9/4/2013
Background g
Two groups of approaches:
Point Processing: when the neighborhood is of size 11, it becomes a gray level (or intensity or mapping) transformation function of the form: s =T (r) where r and s denote the gray level at f(x,y) and g(x,y) at any y point p (x,y y) ). Mask-Based: uses small arrays y called mask, , whose coefficients determine the nature of the process.
9/4/2013
Point Processing g
Image Negatives
Output g gray leve el - s
T(r)
Point Processing g
Contrast Stretching
(r2,s2)
T(r)
(r1,s s1)
Point Processing g
Power Law Transformation (Gamma Correction)
Correo Gama
Output g gray leve el - s
=0.04 =0.1 =0.2 =0.4 =0.67 =1 1 =1.5 =2.5 =5.0 5.0 =10 =25
where
Point Processing g
Power Law Transformation (Gamma Correction)
=0.04 =0.1 =0.04 =0.2 =0.1
Correo Gama
where
=0.2 =0.4 =0.4 =0.67 =0.67 =1 =1 1 =1.5 =1.5 =2.5 =2.5 =5.0 5.0 =5.0 5.0 =10 =10 =25 =25
Point Processing g
Brightness Adjustment
s = r b , subjected to 0 s 1
Histogram g Processing g
Definition The histogram g of a digital g image g with g gray y levels in the range [0,L-1] is a discrete function where:
rk is the kth gray level, nk is the number of pixels having gray level rk
9/4/2013
11
Histogram g Processing g
Example: dark image
9/4/2013
12
Histogram g Processing g
Example: bright image
9/4/2013
13
Histogram g Processing g
Example: image with low contrast
9/4/2013
14
Histogram g Processing g
Example: image with high contrast
9/4/2013
15
Histogram g Processing g
When the pixel counts are normalized and pixel intensity (gray value) is considered a random variable, histogram is analogous to a PDF
where h :
rk is the kth gray level, nk is i the h number b of f pixels i l having h i gray level l l rk, and d n is the number of pixels in the image.
Enhancement in the Spatial Domain 16
9/4/2013
Histogram g Processing g
Histogram Equalization
Problem formulation: design a function s =T (r) that transforms a given input image so that the output image has uniformly distributed gray levels.
9/4/2013
17
Histogram g Processing g
Histogram Equalization
Let pr(r) and ps(s) be the histogram respectively of the input and of the output images Assume that r and s represent the continuous gray levels in the interval [0,1]. [0 1] Search for the transformation function T (r) satisfying the following conditions:
a)
b) c)
T(r) is a single-valued and monotonically increasing in [0,1] 0 T(r) 1 for 0 r 1 the inverse function T-1(s) must also meet the above conditions
9/4/2013
18
Histogram g Processing g
Histogram Equalization
From basic probability theory, if pr(r) and T(r) are known and T(r) is continuous and differentiable:
9/4/2013
19
Histogram g Processing g
Histogram Equalization
From basic probability theory, if pr(r) and T(r) are known and T(r) is continuous and differentiable:
9/4/2013
20
Histogram g Processing g
Histogram Equalization
9/4/2013
21
Histogram g Processing g
Histogram Equalization
9/4/2013
22
Histogram g Processing g
rk r0 = 0 r1 = 1 r2 = 2 r3 = 3 r4 = 4 r5 = 5 r6 = 6 r7 = 7 nk 790 1023 850 656 329 245 122 81 p(rk) = nk/n 0.19 0 25 0.25 0.21 0.16 0.08 0.06 0.03 0.02
9/4/2013
23
Histogram g Processing g
9/4/2013
24
Histogram g Processing g
Histogram Equalization
A histogram is and approximation of a PDF and no new gray values are created: perfectly flat equalized equalized histograms are rare. Cannot be proved (in general) that discrete histogram equalization results in uniform histogram. Intensity levels of equalized image have a wider dynamic range. Net result is contrast enhancement. enhancement
9/4/2013
25
Histogram g Processing g
T(r)
Equalization
9/4/2013
26
Histogram g Processing g
Histogram Matching
Problem formulation: design a transformation function s =T T (r) that transforms a given input image so that the output image has a specified histogram.
9/4/2013
27
Histogram g Processing g
Histogram Matching
Let pr(r) and ps(s) be the histogram of the input image and the desired (reference) histogram histogram.
input pr(r) H(r) G-1(z) pr(r) s = T(r) = G-1[H(r)] ps(s) uniform if G(s) reference ps(s)
9/4/2013
28
Histogram g Processing g
Histogram Matching
image 1999 image 1999 with i ith th the histogram of image 2001 i image 2001
9/4/2013
29
Local Enhancement
The parameters of most functions presented so far are computed based on the whole image. To enhance details in small image areas (example):
1. Select a neighborhood, whose center moves from pixel to pixel over the th image. i 2. At each position find the transformation function based on the pixel neighborhood. neighborhood 3. Apply the function to the pixel at the center of the neighborhood. pixel and repeat p steps p 2 and 3 till all 4. Move the center to the next p image is covered.
9/4/2013
30
Local Enhancement
Example: local histogram equalization
Original Image After Global Equalization After Local Equalization
9/4/2013
31
Logical matrices called masks can be used to define regions in an image (roi) where an operator is to be applied. Example: blurring uninteresting regions
input image mask (roi) output image
9/4/2013
32
Local Enhancement
Histogram Statistics for Enhancement
(r
i=0
L 1
m ) p (ri )
n
where
m =
L 1 i=0
ri p (ri )
9/4/2013
33
Local Enhancement
Histogram Statistics for Enhancement
(r
s ,t
mS xy
) p(r )
2 s ,t
9/4/2013
34
Local Enhancement
Histogram Statistics for Enhancement
Example: enhance SEM image (tungsten filament wrapped around a support) Enhance only dark areas Enhance low contrast areas, but not constant/uniform areas
9/4/2013
35
Local Enhancement
Histogram Statistics for Enhancement
Example: enhance SEM image (tungsten filament wrapped around a support) Enhance only dark areas:
mS xy k0 M G
MG is the global mean mS xy is the local mean k0 is positive, less than one Sxy is 3x3
9/4/2013
36
Local Enhancement
Histogram Statistics for Enhancement
Example: enhance SEM image (tungsten filament wrapped around a support) Enhance low contrast areas:
S k 2 DG
xy
DG is the global standard dev S is the local standard dev k2 is positive, less than one Sxy is 3x3
xy
9/4/2013
37
Local Enhancement
Histogram Statistics for Enhancement
Example: enhance SEM image (tungsten filament wrapped around a support) Enhance non uniform areas:
k1 DG S xy
DG is the global standard dev S is the local standard dev k1 is positive, less than k2 Sxy is 3x3
xy
9/4/2013
38
Local Enhancement
Histogram Statistics for Enhancement
Example: enhance SEM image (tungsten filament wrapped around a support) Enhance only dark areas Enhance low contrast areas, but not constant/uniform areas
9/4/2013
39
Local Enhancement
Histogram Statistics for Enhancement
Example: enhance SEM image (tungsten filament wrapped around a support) Enhance only dark areas Enhance low contrast areas, but not constant/uniform areas
E=4;k0=0.4;k1=0.02;k2=0.4}
9/4/2013 Enhancement in the Spatial Domain 40
Spatial p Filters
Operation:
ww w w 1 1w 11 2w 11 3 2 w1 4 w1 5 w2 4 2 6 5 4 1 3 w1 7 w4 4 8 w5 7 1 5 9 8 7 1 6 w1 7 w7 8 w8 9
g(x,y)=T [ f(x,y)],
w1 3 w2 2 3 w3 w3 6 w5 5 4 6 w6 . . . w6 9 w8 8 7 9 w9 a b g ( x , y ) = w (s , t ) f ( x + w9 s= at=b
s, y + t )
Smoothing g Filters
Aplications: p
Removal of small details prior to large object extraction. Noise reduction. It blurs the image. All elements are non-negative, and sum up to 1.
Side Effect
Smoothing masks
Masks
1 1 1 1/9 1 1 1 1 1 1
averaging filter 33
1 7 1 1/88 7 54 7 1 7 1
gaussian filter 33
42
9/4/2013
Smoothing g Filters
Examples of applying an averaging filter:
original
33
55
77
9/4/2013
1515
Enhancement in the Spatial Domain
2525
43
Smoothing g Filters
Order Statistic Filters are non-linear spatial p filters whose response p is based on ordering (ranking) the pixels contained in the image area encompassed by the mask, mask and then replacing the value of the center pixel with the value determined by the ranking result. result
9/4/2013
44
Smoothing g Filters
Median Filter replaces the value of a pixel by the median of the gray levels in its neighborhood g A median of a set of values is such that half of the values in the set is lower than and half f of f the values in the set is greater than or equal to . Percentile Filter replaces the value of a pixel by n-th percentile of the gray g y levels in its neighborhood. g
Enhancement in the Spatial Domain 45
9/4/2013
Smoothing g Filters
Examples :
Original image
Adaptive p Filter
The output p g(x,y ,y) of a adaptive p filter depends p on the statistical characteristics of the input image f(x,y) inside a m mn n rectangular window Sxy centered at (x,y). variance of the noise (?)
2 g ( x, y ) = f ( x, y ) 2 [ f ( x, y ) mL ] L
variance in Sxy
9/4/2013 Enhancement in the Spatial Domain
mean in Sxy
47
Adaptive p Filter
2 is zero: no noise, nothing should change 2 2 is high relative to : no change, probably an edge L 2 2 is similar to : reduce noise by averaging L 2 2 L is less than : must avoid/treat negative output
variance in Sxy
9/4/2013 Enhancement in the Spatial Domain
mean in Sxy
48
Adaptive p Filter
Example p
image corrupted by additive Gaussian noise of zero mean and variance 1000
9/4/2013
49
Sharpening p g Filters
Applications pp
Highlight of fine details. Enhance details that have been blurred due to the acquisition method.
Side Effect
9/4/2013
50
Sharpening p g Filters
Accomplished by spatial differentiation:
lim
x o
f (x + x ) f (x ) f (x + 1 ) f (x ) x
9/4/2013
51
Sharpening p g Filters
9/4/2013
52
Edge g Detection
-1 0 -1 0 -1 0 1 1 1 4 3 2 1 0 4 3 2 1 0 -1 -2 -3 -4 4 3 2 1 0 -1 -2 -3 -4
Prewitt mask
first derivative
second derivative
9/4/2013
Image Segmentation
53
Sharpening p g Filters
1.
2.
3.
4.
9/4/2013
54
Sharpening p g Filters
Laplacian Filter
2 f 2 f f = + 2 x y 2
2
Starting from
2 f f ( x + 1, y ) 2 f (x, y ) + f (x 1, y ) 2 x
2 f f ( x , y + 1) 2 f ( x , y ) + f ( x , y 1) 2 y
we obtain b i
2 f = [ f ( x + 1, y ) + f (x 1, y ) + f ( x, y + 1) + f ( x, y 1) 4 f (x, y )
9/4/2013 Enhancement in the Spatial Domain
]
55
Sharpening p g Filters
0 0
1 1
0 0
1 1
1 1
1 1
1 1
4 4
1 1
1 -4 1
1 -8 1
4 -20 4
9/4/2013
56
Sharpening p g Filters
Laplacian based filter : an example f ( x, y ) C 2 f ( x, y ) if center coefficient <0 f s ( x, y ) = 2 ( ) f x y C f ( x, y ) if center coefficient >0 , + The Th sharpening h i effect ff t i in 1-D 1D
f ( x)
2 f (x) f ( x) 2 f ( x)
shaper transition
9/4/2013
57
Sharpening p g Filters
0 0 0
0 1 0
0 0 0 -C
0 1 0
1 -4 1
0 1 0
-C
- C 4C+1 - C 0 -C 0
9/4/2013
58
Sharpening p g Filters
C=6
C=8
C=10
9/4/2013
59
Sharpening p g Filters
Unsharp masking
Subtracts a blurred version of an image g from the image g itself
f um ( x, y ) = f ( x, y ) f ( x, y )
Example of a mask
0 0 0 0 1 0 0 0 0 1
1/9 1
1
9/4/2013
60
Sharpening p g Filters
Filter High-Boost
It is a generalization of unsharp masking, given by
f hb ( x, y ) = Af ( x, y ) f ( x, y ) for A 1
f hb ( x, y ) = ( A 1) f ( x, y ) + f s ( x, y ) for A 1
output of a sharpening filter
Sharpening p g Filters
laplacian
9/4/2013
62
Sharpening p g Filters
The Gradient
f x f = f y
f f f = mag (f ) = + x y
2 2 1/ 2
9/4/2013
63
Sharpening p g Filters
-1 0 1 1 1 1
-1 0 1 -1 -2 2 -1
-2 0 2
Sobel
-1 0 1 1 2 1
64
Roberts 0 1
0 0 0
0 0 0
-1 1
9/4/2013
Sharpening p g Filters
Gradient: example
original image
|Gx| (sobel)
|Gy| (sobel)
|Gx|+|Gy| (sobel)
9/4/2013 Enhancement in the Spatial Domain 65
Next Topic p