Download presentation
Presentation is loading. Please wait.
1
Edges and Contours– Chapter 7
continued
2
Edge detection All of the previously studied edge detection filters worked on finding local gradients (1st derivative) As such, all had to make decisions regarding the actual existence of an edge based on local information
3
Sobel edges – threshold on magnitude
4
Sobel edges – threshold on magnitude
The preceding images were edge-detected with a Sobel operator then binarized with various thresholds The overall trend is predictable but the individual results are not This threshold dependency is the curse of image processing Difficult to isolate “real” edges Difficult to find accurate edge location We need smarter algorithms
5
Scale space processing
One method of dealing with the threshold dependency is through scale-space processing An image is processed at various scales (sizes/resolution) revealing different sets of features at each scale Features common to all [or many] sets are deemed “important”
6
The Gaussian Pyramid Select a set of Gaussian filter parameters (sigma and width) and blur the image Save the image Reduce it’s size by subsampling (eliminating every other row/column) Do it again
7
The Gaussian Pyramid You end up with a series of images (a pyramid) each exposing different features Coarse features at the top of the pyramid Fine features at the bottom You can now use the coarse features to select where to concentrate your processing of the fine features
8
Better (different) algorithms
Another method of dealing with the threshold dependency is through more complex algorithms
9
A better kernel The Sobel mask is a derivative mask (computes the weighted difference of neighborhood pixels) So is the Laplacian (negative in the middle, positive around the rest) From calculus: the 2nd derivative of a signal is zero when the derivative magnitude is extremal
10
A better kernel Combining these observations we can derive the Laplacian-Gaussian filter due to Marr and Hildreth Also known as a DoG (Difference of Gaussians) because it can be approximated by subtracting two Gaussian kernels of same width and differing sigmas
11
The Gaussian kernel Sigma 1.6, Filter Width 15
12
The Laplacian-Gaussian kernel
Bypassing the math and jumping to the results of applying the rules of calculus… Similar in form to the Gaussian kernel
13
The Laplacian-Gaussian kernel
In 1 dimension… Can be approximated by difference of two Gaussians
14
The Laplacian-Gaussian kernel
Convolution with this kernel results in edge magnitudes of both positive and negative values We’re interested in where the sign changes occur (the zero crossing) These are where the edges are (recall the calculus result)
15
Sobel vs. Laplacian-Gaussian
L-G does not detect as much “noise” as Sobel – why not?
16
Still something missing…
What are we ignoring in the following edge detection processes? Gaussian filter Sobel edge detection Threshold based binarization of Sobel magnitude And Laplacian-Gaussian filter Zero crossing detection
17
We need a smarter algorithm
We merely selected each edge based on its magnitude and zero-crossing We completely ignored its immediate surroundings Why is this bad? Detects edges we don’t want Prone to noise Prone to clutter Doesn’t detect edges we do want Weak magnitude edges are thresholded (thresheld?) away We need a smarter algorithm!
18
The Canny edge detector
John Canny – MIT 1986 Developed a process (series of steps) for identifying edges in an image Gaussian smoothing of input image Local derivative operator to detect edge candidates Removal of edges that are clustered around a single location Adaptive thresholding algorithm for final edge selection
19
Concepts Gaussian smooth original image Local derivative operator
Reduce the effects of noise Local derivative operator Simple neighbor pixel subtraction to detect gradients (1st derivative) Non-maximal suppression Thin out the edges around a given point Threshold Use two thresholds combined with spatial continuity
20
Spatial continuity aka contour following
Apply the high threshold to get “obvious” edges Search for a neighboring edge above the low threshold in the direction of the strong edge We’re using a strong edge as an anchor point for a contour of weak and strong edges – known as Hysteresis
21
Canny results With very conservative high/low thresholds
22
Results All edges Weak edges Contours Strong edges
23
Summary Through more complex processing we arrive at a set of edges in which we have confidence Minimal reliance on thresholds The cost is complex (slow, memory intensive) processing We must trade resources for accuracy!
24
ImageJ Download/install plugins for Plugins->FeatureJ->Edges
Sobel, Prewitt, Roberts, Kirsch, Nevatia-Babu Plugins->FeatureJ->Edges Canny implementation
25
Edge Sharpening An process for making an image look “better”
In this case “better” means “sharper” The general approach is to amplify the high-frequency components (the edges) to create a “perceived” sharpness
26
Method 1 – subtract 2nd derivative
This causes a step edge to undershoot at the bottom and overshoot at the top The Laplacian works well for the 2nd derivative
27
ImageJ Note that this is difficult to do in ImageJ since the convolution operation clamps negative pixel values to 0
28
Unsharp mask Steps Subtract a Gaussian-smoothed version of the image from the original creating a mask Add a weighted version of the mask to the original image
29
ImageJ Plugins->Chapter07->Filter UnsharpMask
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.