local enhancement - uc santa barbaramanj/ece178-fall2008/e178-l7(2008).pdflocal enhancement 21 image...
TRANSCRIPT
Local Enhancement 1
Local Enhancement
• Local Enhancement•Median filtering (see notes/slides, 3.5.2)
•HW4 due next Wednesday•Required Reading: Sections 3.3, 3.4, 3.5, 3.6, 3.7
Local Enhancement 2
Local enhancement
Sometimes LocalEnhancement isPreferred.
Malab: BlkProcoperation for blockprocessing.
Left: original “tire”image.
Local Enhancement 3
Histogram equalized
Local Enhancement 4
Local histogram equalized
F=@ histeq;I=imread(‘tire.tif’);J=blkproc(I,[20 20], F);
Local Enhancement 5
Fig 3.23: Another example
Local Enhancement 6
Local Contrast Enhancement
• Enhancing local contrast g (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)
Local Enhancement 7
Fig 3.24
Local Enhancement 8
Fig 3.25
Local Enhancement 9
Fig 3.26
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 moderadiography”
• H(x,y) is the mask, e.g., an X-ray image of part of abody; f(x,y) –incoming image after injecting acontrast medium.
Local Enhancement 11
Subtraction: an example
Local Enhancement 12
Fig 3.28: mask mode radiography
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
i
i
M
g
( , ) ( , ) ( , )
( , ) ( , )
( ( , )) ( , ) ( , )
( , )
( , ) Re
= +
=
= =
!
!
=
"
#
$ $
#
$
#
#
1
1
1
Local Enhancement 14
Fig 3.30
Local Enhancement 15
Another exampleImages with additiveGausian Noise;IndependentSamples.
I=imnoise(J,’Gaussian’);
Local Enhancement 16
Averaged image
Left: averaged image (10 samples); Right: original image
Local Enhancement 17
Spatial filtering
Frequency
Spatial
0
LPFHPF BPF
Local Enhancement 18
Smoothing (Low Pass) Filtering
ω1 ω2 ω3
ω4 ω5 ω6
ω7 ω8 ω9
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
^
( , ) =!"
Local Enhancement 19
Fig 3.35: smoothing
Local Enhancement 20
Fig 3.36: another example
Local Enhancement 21
Image Dithering
• Dithering: to produce visually pleasing signalsfrom heavily quantized data.– Halftoning: convert a gray scale image to a binary
image by thresholding.– Dithering to “add” noise so that the resulting image is
smoother than just thresholding (but still it is a binaryimage)
– Your homework #4 explores this further with aMATLAB exercise.
Local Enhancement 22
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:
10 20 20
20 15 20
25 20 100
( 10,15,20,20,20,20,20,25,100)
Median=20 So replace (15) with (20)
Local Enhancement 23
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 themedina 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 00 0 0 1 1 1 1 1 1 1 0 0 0 root signal
Local Enhancement 24
Invariant Signals
Invariant signals to a median filter:
ConstantMonotonically
increasing decreasing
length?
Local Enhancement 25
Fig 3.37: Median Filtering example
Local Enhancement 26
Media Filter: another example
Original and with salt & pepper noiseimnoise(image, ‘salt & pepper’);
Local Enhancement 27
Donoised images
Local averagingK=filter2(fspecial(‘average’,3),image)/255.
Median filteredL=medfil2(image, [3 3]);
Local Enhancement 28
Sharpening Filters
• Enhance finer image details (such as edges)• Detect region /object boundaries.
−1 −1 −1−1 8 −1−1 −1 −1
Example:
Local Enhancement 29
Edges (Fig 3.38)
Local Enhancement 30
Unsharp Masking
Subtract Low pass filtered version from the originalemphasizes high frequency information
I’ = A ( Original) - Low passHP = O - LP A > 1I’ = ( A - 1 ) O + HPA = 1 => I’ = HPA > 1 => LF components added back.
Local Enhancement 31
Fig 3.43 –example of unsharp masking
Local Enhancement 32
Derivative Filters
−1 −1 −1−1 ω −1−1 −1 −1
1/9 Gradient
!f =" f"x
" f"y
#
$%
&
'(
T
!f =" f"x
)
*+,
-.
2
+" f"y
)
*+,
-.
2#
$%%
&
'((
12
Local Enhancement 33
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
!f =" f"x
" f"y
#$%
&'(
T
Local Enhancement 34
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 " z5# z
8( )2
+ z5# z
6( )2$
%&'
12
!f " z5# z
8+ z
5# z
6
Local Enhancement 35
Fig 3.45: Sobel edge detector
Local Enhancement 36
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.
! = +2
2
2
2
2f
f
x
f
y
"
"
"
"
Local Enhancement 37
Fig 3.40: an example