Post on 31-May-2020
02/07/2002 Local Enhancement 1
Local Enhancement
� Local Enhancement�Median filtering
02/07/2002 Local Enhancement 2
Local enhancement
Sometimes LocalEnhancement is Preferred.
Malab: BlkProc operation for block processing.
Left: original �tire� image.
02/07/2002 Local Enhancement 3
Histogram equalized
02/07/2002 Local Enhancement 4
Local histogram equalized
F=@ histeq;I=imread(�tire.tif�);J=blkproc(I,[20 20], F);
02/07/2002 Local Enhancement 5
Fig 3.23: Another example
02/07/2002 Local Enhancement 6
Local Contrast Enhancement
� Enhancing local contrastg (x,y) = A( x,y ) [ f (x,y) - m (x,y) ] + m (x,y)
A (x,y) = k M / σ(x,y) 0 < k < 1
M : Global meanm (x,y) , σ (x,y) : Local mean and standard dev.
Areas with low contrast ! Larger gain A (x,y) (fig 3.24-3.26)
02/07/2002 Local Enhancement 7
Fig 3.24
02/07/2002 Local Enhancement 8
Fig 3.25
02/07/2002 Local Enhancement 9
Fig 3.26
02/07/2002 Local Enhancement 10
Image Subtraction
g (x,y) = f (x,y) - h (x,y)h(x,y)�a low pass filtered version of f(x,y).
� Application in medical imaging --�mask mode radiography�
� H(x,y) is the mask, e.g., an X-ray image of part of a body; f(x,y) �incoming image after injecting a contrast medium.
02/07/2002 Local Enhancement 11
Subtraction: an example
02/07/2002 Local Enhancement 12
Fig 3.28: mask mode radiography
02/07/2002 Local Enhancement 13
Averaging
Fig 3.30
and
Uncorrelated zero mean
duces the noise variance
2 2
2
g x y f x y x y
g x yM
g x y
E g x y f x yM
x y
x y
x y
ii
M
g
( , ) ( , ) ( , )
( , ) ( , )
( ( , )) ( , ) ( , )
( , )
( , ) Re
= +
=
= =
→
→
=∑
η
σ σ
ησ
η
η
1
11
02/07/2002 Local Enhancement 14
Fig 3.30
02/07/2002 Local Enhancement 15
Another example Images with additiveGausian Noise; IndependentSamples.
I=imnoise(J,�Gaussian�);
02/07/2002 Local Enhancement 16
Averaged image
Left: averaged image (10 samples); Right: original image
02/07/2002 Local Enhancement 17
Spatial filtering
Frequency
Spatial
0
LPFHPF BPF
02/07/2002 Local Enhancement 18
Smoothing (Low Pass) Filtering
ωωωω1111 ωωωω2222 ωωωω3333
ωωωω4444 ωωωω5555 ωωωω6666
ωωωω7777 ωωωω8888 ωωωω9999
f1 f2 f3
(x,y)
Replace f (x,y) with
Linear filter
LPF: reduces additive noise" blurs the image! sharpness details are lost (Example: Local averaging)
Fig 3.35
f x y fii
i
^( , ) =∑ω
02/07/2002 Local Enhancement 19
Fig 3.35: smoothing
02/07/2002 Local Enhancement 20
Fig 3.36: another example
02/07/2002 Local Enhancement 21
Median filtering
Replace f (x,y) with median [ f (x� , y�) ](x� , y�) E neighbourhood
� Useful in eliminating intensity spikes. ( salt & pepper noise)� Better at preserving edges.
Example:
10101010 20202020 20202020
20202020 15151515 20202020
25252525 20202020 100100100100
( 10,15,20,20,20,20,20,25,100)
Median=20 So replace (15) with (20)
02/07/2002 Local Enhancement 22
Median Filter: Root Signal
Repeated applications of median filter to a signal resultsin an invariant signal called the �root signal�.A root signal is invariant to further application of the medina filter.
ExampleExample: 1-D signal: Median filter length = 30 0 0 1 2 1 2 1 2 1 0 0 00 0 0 1 1 2 1 2 1 1 0 0 00 0 0 1 1 1 2 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 root signal
02/07/2002 Local Enhancement 23
Invariant Signals
Invariant signals to a median filter:
ConstantMonotonically
increasing decreasing
length?
02/07/2002 Local Enhancement 24
Fig 3.37: Median Filtering example
02/07/2002 Local Enhancement 25
Media Filter: another example
Original and with salt & pepper noiseimnoise(image, �salt & pepper�);
02/07/2002 Local Enhancement 26
Donoised images
Local averagingK=filter2(fspecial(�average�,3),image)/255.
Median filteredL=medfil2(image, [3 3]);
02/07/2002 Local Enhancement 27
Sharpening Filters
� Enhance finer image details (such as edges)� Detect region /object boundaries.
−1−1−1−1 −1−1−1−1 −1−1−1−1−1−1−1−1 8 8 8 8 −1−1−1−1−1−1−1−1 −1−1−1−1 −1−1−1−1
Example:
02/07/2002 Local Enhancement 28
Edges (Fig 3.38)
02/07/2002 Local Enhancement 29
Unsharp Masking
Subtract Low pass filtered version from the original emphasizes high frequency information
I� = A ( Original) - Low passHP = O - LP A > 1I� = ( A - 1 ) O + HPA = 1 => I� = HP A > 1 => LF components added back.
02/07/2002 Local Enhancement 30
Fig 3.43 �example of unsharp masking
02/07/2002 Local Enhancement 31
Derivative Filters
−1−1−1−1 −1−1−1−1 −1−1−1−1−1−1−1−1 ω ω ω ω −1−1−1−1−1−1−1−1 −1−1−1−1 −1−1−1−1
1/9 Gradient
∇ =LNM
OQP
∇ =FHGIKJ +FHGIKJ
LNMM
OQPP
f fx
fy
f fx
fy
T∂∂
∂∂
∂∂
∂∂
2 21
2
02/07/2002 Local Enhancement 32
Edge Detection
Gradient based methods
xx0 xx0
f(x)f�(x)
xx0
f �(x)
f(x) d(.)/dx | . | Thresholdf�(x)
|f�(x)|
<
> Localmax
No
Yes X0 is anedge
Not an edge X0 not an edge
∇ =FHG
IKJf f
xfy
T∂∂
∂∂
02/07/2002 Local Enhancement 33
Digital edge detectors
z1 z3
z4 z5 z6
z7 z8 z9
z2
Robert�s operator
1 00 -1
0 1-1 0
prewitt
| z5-z9 | | z6-z8 |
-1 -1 -10 0 01 1 1
-1 0 1-1 0 1-1 0 1
Sobel�s
-1 -2 -10 0 01 2 1
-1 0 1-2 0 2-1 0 1
∇ ≈ − + −
∇ ≈ − + −
f z z z z
f z z z z
5 82
5 62
5 8 5 6
12b g b g
02/07/2002 Local Enhancement 34
Fig 3.45: Sobel edge detector
02/07/2002 Local Enhancement 35
Laplacian based edge detectors
11 -4 1
1
�Rotationally symmetric, linear operator�Check for the zero crossings to detect edges�Second derivatives => sensitive to noise.
∇ = +22
2
2
2f fx
fy
∂∂
∂∂
02/07/2002 Local Enhancement 36
Fig 3.40: an example