Digital Image Processing (CS/ECE 545) Lecture 5: Edge Detection (Part 2) & Corner Detection Prof Emmanuel Agu
Computer Science Dept. Worcester Polytechnic Institute (WPI)
Digital Image Processing (CS/ECE 545) Lecture 5: Edge Detection (Part - - PowerPoint PPT Presentation
Digital Image Processing (CS/ECE 545) Lecture 5: Edge Detection (Part 2) & Corner Detection Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Edge Detection Image processing task that finds edges and
Computer Science Dept. Worcester Polytechnic Institute (WPI)
Image processing task that finds edges and contours in
Edges so important that human vision can reconstruct
Real (non‐ideal) edge is a slightly blurred step function Edges can be characterized by high value first derivative
Rising slope causes positive + high value first derivative Falling slope causes negative + high value first derivative
Image is 2D discrete function Image derivatives in horizontal and vertical directions Image gradient at location (u,v) Gradient magnitude Magnitude is invariant under image
Compute image derivatives by convolution Compute edge gradient magnitude Compute edge gradient direction
Scaled Filter results
Typical process of Gradient based edge detection
Problem with edge operators
Edge is proportional to underlying
Edges may be difficult to localize
Solution? Use second derivative
Recall: An edge corresponds to a
Since 2nd derivatives amplify image
Edge First derivative Second derivative
Simple edge operators deviate from human perception in
Edge operators respond to local intensity differences while
Edges exist at multiple scales
Hierarchical or pyramid techniques:
For each image position (u,v), apply edge detection filters
Use most dominant edge/scale detected (if any)
Popular edge detector that operates at different scales,
1.
2.
3.
Resulting edge maps for different settings of the smoothing (scale) parameter σ
Edge detection yields at each image position (u,v)
Edge strength + orientation
How can this information be used to detect larger image
Contour following: Starting from image point with high
Several obstacles make this impractical and rarely used:
Edges may end in regions of vanishing intensity gradient Crossing edges lead to ambiguities Contours may branch into several directions
Usually after calculating edge strengths, we just make
Most common approach: generate edge map by appying
In practice edge maps seldom contain perfect contours Edge map frequently has small, unconnected contour
Blurring may occur during image scanning or scaling Sharpening reduces effects of blurring How? Amplify high frequency components High frequencies occur at edges We need to sharpen edges Two main approaches:
Using Laplace filter
Unsharp masking
Edge First derivative Second derivative Image intensity 2nd derivative
Weight
2D Laplace operator: combines 2nd derivatives in
Laplace operator defined as:
2nd derivative
x direction 2nd derivative
y direction
Laplacian: Digital approximation of laplacian is:
Laplacian:
1d filters that estimate 2nd derivatives along x and y directions 2-dimensional Laplace filter
Synthetic test Image I Second partial derivative in Vertical direction Laplace filter Second partial derivative in horizontal direction
To perform actual
First apply Laplace filter to Image I
Subtract fraction of result from original image
Original image with horizontal profile Result of Laplace filter HL Sharpened Image
2-dimensional Laplace filter
A technique for edge sharpening
Combine image with smoothed (blurred) version of image
Subtract smooth version (Gaussian smoothing) from
Add the mask to image with a weight Together: Advantages of USM over Laplace filter
Reduced noise sensitivity due to smoothing Improved control through parameters σ and a
Intensity profile at line Results of USM (σ = 2.5) Results of USM (σ = 10.0)
Convert original image to FloatProcessor object Create image to hold blurred copy Create gaussian kernel Apply gaussian kernel in Vertical and horizontal directions
USM implemented in ImageJ by plugin class ij.plugin.filter.UnsharpMask
Computer Science Dept. Worcester Polytechnic Institute (WPI)
Corners are robust, used in computer vision for matching
Consider small squares called patches of same size in
The task? Find most similar patch in second image
More robust to use distinctive patches Example: Don’t use patches similar to many patches
Corners are unique, match patches with corners What are corners? Junctions of contours Corners appear as large changes in intensity in
Patch at corner: shifting window in any direction
Is patch at corner? shift window in multiple directions,
Harris corner detector gives mathematical approach for
Flat region: no intensity change in all directions Edge: no change along edge directions Corner: significant intensity change in many directions
Shift patch by [u,v] and compute change in intensity Change of intensity for shift [u,v]
Change of intensity for shift [u,v]
For nearly flat regions: this quantity almost 0 For distinctive (corner) : this quantity almost large Hence... Corners? Patches where E(u,v) is LARGE
First order approximation
For small shifts [u, v], we have following approximation
If we compute derivatives A(u,v), B(u,v) and C(u,v) Can express matrix M as
Treat gradient vectors as set of (dx,dy) points with center at (0,0) Fit an ellipse to that set of points via scatter matrix Analyze ellipse parameters for varying cases…
Flat regions (equal dx,dy) Edge Regions (large dx, small dy)
Corner (large dx,dy)
Note: Same function
An image location (u,v) is candidate for corner point when tH is threshold selected based on image content, typically lies
Detected corners inserted into set and sorted in descending
Many false corners occur in neighborhood of real corner Traverse sorted list, delete false corners towards end of list
Image with final corner points marked Before thresholding values After thresholding
Declare filter values Create copies of Image
Apply pre-smoothing + gradient computation in one combined step Compute components A, B, C and smooth
Compute Corner Response Function
Declare Corners
Test image coordinates for Corners & sort
1. c4 is added to new list goodCorners
Circle of radius dmin ) are removed
Delete weak corners
Delete weak corners (code)
Actual run method
Wilhelm Burger and Mark J. Burge, Digital Image
Robert Collins, CSE 486 slides, Penn State University University of Utah, CS 4640: Image Processing Basics,
Rutgers University, CS 334, Introduction to Imaging
Gonzales and Woods, Digital Image Processing (3rd