Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise...
Transcript of Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise...
![Page 1: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/1.jpg)
1
Digital Image Processing
Lecture # 5Sharpening Filters & Edge Detection
![Page 2: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/2.jpg)
2
Smoothing Spatial Filters
Simply average all of the pixels in a neighbourhood around
a central value
1/91/9
1/9
1/91/9
1/9
1/91/9
1/9
Simple
averaging
filter
![Page 3: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/3.jpg)
3
Smoothing Spatial Filters
For blurring/noise reduction
Blurring is usually used in preprocessing steps, e.g., to remove
small details from an image prior to object extraction, or to bridge
small gaps in lines or curves
Equivalent to Low-pass spatial filtering in frequency domain
because smaller (high frequency) details are removed based on
neighborhood averaging (averaging filters)
![Page 4: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/4.jpg)
4
Smoothing Spatial Filters
1/91/9
1/91/9
1/91/9
1/91/9
1/9
Origin x
y Image f (x, y)
e = 1/9*106 + 1/9*104 + 1/9*100 + 1/9*108 + 1/9*99 + 1/9*98 + 1/9*95 + 1/9*90 + 1/9*85
= 98.3333
FilterSimple 3*3
Neighbourhood106
104
99
95
100 108
98
90 85
1/91/9
1/9
1/91/9
1/9
1/91/9
1/9
3*3 Smoothing
Filter
104 100 108
99 106 98
95 90 85
Original Image
Pixels
*
The above is repeated for every pixel in the original image to generate the smoothed image
![Page 5: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/5.jpg)
5
Smoothing Filter: Example
original 3x3 average
![Page 6: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/6.jpg)
6
Smoothing Filter: Example
original 3x3 average
![Page 7: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/7.jpg)
7
Smoothing Filter: Example
original 3x3 average
![Page 8: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/8.jpg)
8
Smoothing Filter: Example
original 3x3 average
![Page 9: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/9.jpg)
9
Original image
Size: 500x500
Smooth by 3x3
box filter
Smooth by 5x5
box filterSmooth by 9x9
box filter
Smooth by
15x15 box filter
Smooth by
35x35 box filter
Notice how detail begins to disappear
![Page 10: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/10.jpg)
10
Smoothing Spatial Filters
Box Filter all
coefficients are
equal
Weighted Average give
more (less) weight to near
(away from) the output
location
Consider the
output pixel is
positioned at
the center
![Page 11: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/11.jpg)
11
Order-Statistic Filtering
Output is based on order of gray levels in the masked area
Some simple neighbourhood operations include:
Min: Set the pixel value to the minimum in the
neighbourhood
Max: Set the pixel value to the maximum in the
neighbourhood
Median: The median value of a set of numbers is the
midpoint value in that set
![Page 12: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/12.jpg)
12
Median Filter
• For an image, mask symmetric: 3x3, 5x5, etc.
0 2
1 2
1 2 1
2 5 3
1 3
2 2
0 1
1 2 0
2 2 4
1 0 1
Input Output
Sorted: 0,0,1,1,1,2,2,2,4
1
![Page 13: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/13.jpg)
13
Median Filtering
Median = ? 20
Particularly effective when
The noise pattern consists of strong
impulse noise ( salt-and-pepper)
Sort the values
Determine the median
![Page 14: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/14.jpg)
Salt and Pepper Noise
![Page 15: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/15.jpg)
15
Median Filtering
![Page 16: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/16.jpg)
Min/Max Filtering
![Page 17: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/17.jpg)
Sharpening Spatial Filters
Previously we have looked at smoothing filters which remove
fine detail
Sharpening spatial filters seek to highlight fine detail
Remove blurring from images
Highlight edges
Sharpening filters are based on spatial differentiation
![Page 18: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/18.jpg)
Spatial Differentiation
• Let’s consider a simple 1 dimensional
example
![Page 19: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/19.jpg)
Spatial Differentiation
A B
![Page 20: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/20.jpg)
1st Derivative
The 1st derivative of a function is given by:
Its just the difference between subsequent
values and measures the rate of change of
the function
)()1( xfxfx
f
![Page 21: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/21.jpg)
Image Strip
0
1
2
3
4
5
6
7
8
1st Derivative
-8
-6
-4
-2
0
2
4
6
8
5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7
-1 -1 -1 -1 -1 0 0 6 -6 0 0 0 1 2 -2 -1 0 0 0 7 0 0 0
1st Derivative
![Page 22: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/22.jpg)
2nd Derivative
The 2nd derivative of a function is given by:
Simply takes into account the values both before and after the current value
)(2)1()1(2
2
xfxfxfx
f
![Page 23: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/23.jpg)
Image Strip
0
1
2
3
4
5
6
7
8
5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7
2nd Derivative
2nd Derivative
-15
-10
-5
0
5
10
-1 0 0 0 0 1 0 6 -12 6 0 0 1 1 -4 1 1 0 0 7 -7 0 0
![Page 24: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/24.jpg)
![Page 25: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/25.jpg)
2nd Derivative for Image Enhancement
The 2nd derivative is more useful for image enhancement
than the 1st derivative - Stronger response to fine detail
We will come back to the 1st order derivative later on
The first sharpening filter we will look at is the Laplacian
![Page 26: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/26.jpg)
Laplacian Filter
2
2
2
22
y
f
x
ff
),(2),1(),1(2
2
yxfyxfyxfx
f
The Laplacian is defined as follows:
),(2)1,()1,(2
2
yxfyxfyxfy
f
![Page 27: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/27.jpg)
Laplacian Filter
So, the Laplacian can be given as follows:
),1(),1([2 yxfyxff
)]1,()1,( yxfyxf
),(4 yxf
0 1 0
1 -4 1
0 1 0
Can we implement it using a filter/ mask?
![Page 28: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/28.jpg)
Laplacian Filter
![Page 29: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/29.jpg)
Laplacian Filter
Applying the Laplacian to an image we get a
new image that highlights edges and other
discontinuities
Original
Image
Laplacian
Filtered Image
Laplacian
Filtered Image
Scaled for Display
![Page 30: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/30.jpg)
Laplacian Image Enhancement
The result of a Laplacian filtering is not an
enhanced image
Laplacian
Filtered Image
Scaled for Display2
5
2
5
( , ) , 0( , )
( , ) , 0
f x y f wg x y
f x y f w
To generate the final enhanced image
![Page 31: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/31.jpg)
Laplacian Image Enhancement
In the final sharpened image edges and fine
detail are much more obvious
- =
Original
Image
Laplacian
Filtered Image
Sharpened
Image
![Page 32: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/32.jpg)
Laplacian Image Enhancement
![Page 33: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/33.jpg)
Simplified Image Enhancement
• The entire enhancement can be combined
into a single filtering operation
),1(),1([),( yxfyxfyxf
)1,()1,( yxfyxf
)],(4 yxf
fyxfyxg 2),(),(
![Page 34: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/34.jpg)
Simplified Image Enhancement
• The entire enhancement can be combined
into a single filtering operation
fyxfyxg 2),(),(
),1(),1(),(5 yxfyxfyxf
)1,()1,( yxfyxf0 -1 0
-1 5 -1
0 -1 0
![Page 35: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/35.jpg)
Simplified Image Enhancement
• This gives us a new filter which does the
whole job for us in one step
0 -1 0
-1 5 -1
0 -1 0
![Page 36: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/36.jpg)
Unsharp Masking
![Page 37: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/37.jpg)
![Page 38: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/38.jpg)
Use of first derivatives for image enhancement: The Gradient
• The gradient of a function f(x,y) is defined as
y
fx
f
G
G
y
xf
![Page 39: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/39.jpg)
-1 -2 -1
0 0 0
1 2 1
-1 0 1
-2 0 2
-1 0 1
Extract horizontal edges
7 8 9 1 2 3
3 6 9 1 4 7
( 2 ) ( 2 )
( 2 ) ( 2 )
f z z z z z z
z z z z z z
Emphasize more the current point
(y direction)
Emphasize more the current point (x
direction) Pixel Arrangement
Gradient Operators
Extract vertical edges
Sobel Operator
![Page 40: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/40.jpg)
Sobel Operator: Example
Sobel filters are typically used for edge
detection
An image of a
contact lens
which is
enhanced in
order to make
defects more
obvious
![Page 41: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/41.jpg)
Combining Spatial Enhancement Methods
Successful image enhancement is
typically not achieved using a single
operation
Rather we combine a range of
techniques in order to achieve a final
result
This example will focus on enhancing
the bone scan
![Page 42: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/42.jpg)
![Page 43: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/43.jpg)
![Page 44: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/44.jpg)
Combining Spatial Enhancement Methods
Compare the original and final images
![Page 45: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/45.jpg)
Edge Detection
• Edge detectors can be based on the first and secondderivatives which can detect abrupt intensity changes.
• Derivates of digital functions are defined in terms ofdifferences
• See approximations on using first and second derivativesin Gonzalez section 10.2.1
45
![Page 46: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/46.jpg)
![Page 47: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/47.jpg)
Edge Detection
• First order derivatives produce thick edges while second orderderivatives produce finer ones. See ramp edge on the figure10.2 on previous slide
• Second order derivatives enhance sharp changes and finedetails more aggressively than first order derivatives see theisolated point and the line in the same figure. This can be aproblem if the noise is present in the image
• Second derivative changes its sign as it transitions into andout of a ramp or step edge. See the step edge. This “doubleedge” effect can be used to locate edges.
• The sign of the second derivative is also used to determinewhether an edge is a transition from light to dark (-ve value)or from dark to light (+ve value). See step edge
47
![Page 48: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/48.jpg)
Edge Detection
48
![Page 49: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/49.jpg)
Edges
![Page 50: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/50.jpg)
![Page 51: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/51.jpg)
Edge Detection
• First and second derivativefor smooth noiseless edge• The zero crossings of the
second derivative can be used for locating edges in an image.
51
![Page 52: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/52.jpg)
Edge Detection
Results of first and second derivative for edges with Gaussian noise of mean = 0.
0.0
1.0
0.1
0.10
First derivative
Second derivative
•Smoothing step is a must before taking derivative for edge detection
52
![Page 53: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/53.jpg)
Gradient Operators• Most common differentiation operator is the
gradient vector.
Magnitude:
Direction:
y
x
G
G
y
yxf
x
yxf
yxf),(
),(
),(
xxyx GGGGyxf 2/122
),(
x
y
G
Gyxf 1tan),(
53
![Page 54: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/54.jpg)
Gradient Operators
Some common gradient operators
Roberts and Prewitt masks are the simplest but not robust against noise
Sobel edge detection masks are the most common and give satisfactory results in presence of noise
54
![Page 55: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/55.jpg)
Gradient Operators
![Page 56: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/56.jpg)
•The direction of an edge at a point is orthogonal to the direction of thegradient vector at the point
Direction of an Edge
![Page 57: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/57.jpg)
![Page 58: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/58.jpg)
![Page 59: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/59.jpg)
![Page 60: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/60.jpg)
![Page 61: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/61.jpg)
Laplacian of a Gaussian (LoG)
• A filter which combines the smoothing function (Gaussian) with the Laplacian is called Laplacianof a Gaussian (LoG) filter.
• Robust against noise.
• Consider a smoothing Gaussian function:
where r2 = x2 + y2, : standard deviation
• The Laplacian of this function gives the LoGfunction:
2
2
2)(
r
erG
2
2
24
22
2
22 2)(
)(
r
er
r
rGrG
61
![Page 62: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/62.jpg)
Laplacian of a Gaussian (LoG) Filter
62
![Page 63: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/63.jpg)
Edge detection by LoG
• Due the shape of this function it is also calledMexican hat function (or Mexican hat filters).
• Better performance against noise. Reduces theintensity of structures or noise, which are at scalesmuch smaller than sigma.
• Choose size of Gaussian mask to be n >= 6*sigma
• Then use a 3x3 Laplacian
• Find the zero crossings
63
![Page 64: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/64.jpg)
![Page 65: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/65.jpg)
Readings from Book (3rd Edn.)
• Sharpening Filters (Chapter – 3)• Edge Detection (Chapter – 10)
Reading Assignment • High Boost Filtering (Chap – 3)• Laplacian of Gaussian (LoG) (Chap –
10)
![Page 66: Lecture # 5 Sharpening Filters & Edge Detection file3 Smoothing Spatial Filters For blurring/noise reduction Blurring is usually used in preprocessing steps, e.g., to remove small](https://reader031.fdocuments.net/reader031/viewer/2022022805/5cb98e3488c99358338bea1c/html5/thumbnails/66.jpg)
66
Acknowledgements
Digital Image Processing”, Rafael C. Gonzalez & Richard E. Woods, Addison-Wesley, 2002
Computer Vision for Computer Graphics, Mark Borg
Mat
eria
l in
th
ese
slid
es h
as b
een
tak
en f
rom
, th
e fo
llow
ing
reso
urc
es