Title: Image Processing
1Image Processing 8Edge Detection Video
segmentation
2Edge detection
3Edge detection
- What are edges?
- Why are they interesting?
- How do we find them?
- Prewitt
- Sobel
- Laplacian
- Canny
4What are edges?
- Local intensity change
- Strong edge the steep areas in a 3D plot
- (show blobs-for-edge, surface plot)
Edge detection
5What are edges?
6Why are they interesting?
- Edges can (many times) represent the
- information in the image (the objects)
- A higher level of abstraction (less data to
process!) - Edges are features
- Independent from illumination. As opposed to
e.g., color information - Object recognition and detection (many times) use
edge features - This is true for computer vision as well as for
biological vision systems! - Excellent for measurements
7Edges detectors
- Different detectors, but all have three steps
- Noise reduction
- Edge enhancement
- Edge localisation
8Edges detectors
- Three steps
- Noise reduction
- E.g., median filter
- E.g., mean filter
- Dilemma
- Large filter gt remove noise ?
- Large filter gt remove edges ?
- Small filter gt keep edges ?
- Small filter gt keep noise ?
- Edge enhancement
- Edge localisation
9Edges detectors
- Three steps
- Noise reduction
- Edge enhancement
- Calculate candidates for the edges
- Edge localisation
- Decide which edge candidates to keep
10Edges detectors
- Well look at four methods (but others exist!)
- With respect to complexity (simplest first)
- Prewitt
- Sobel
- Laplacian
- Canny
11Edge Detectors Prewitt and Sobel
12Edge Detectors Prewitt and Sobel
- Simple to implement. Fast
- Based on the grey-level gradient
- A measure of the steepness of the
image-landscape - Calculated for each pixel gt Gradient image
g(x,y) - Use a 16-bit or 32-bit image to represent the
gradients! - The gradient is the first-order derivative
- Approximated in the x- and y-direction by
x
x1
x-1
y-1
y
y1
13Convolution (Foldning) with this kernel
-1
1
Normally this kernel to avoid bias
14Edge Detectors Prewitt and Sobel
gx , gy
- Gradient vector
- Magnitude (hvor kraftig er kanten længden af
blå pil)
15Edge Detectors Prewitt and Sobel
- Noise reduction
- Mean of three gradients
- Edge enhancement
- Implementation of
- Convolution with Prewitt kernels or Sobel
kernels - Edge localisation
- If the magnitude g(x,y) gt TH gt edge found
e(x,y)255 - Else no edge e(x,y)0
- (Show blobs-for-edge, 32-bit, convolution, abs,
TH)
Sobel kernels
Prewitt kernels
16Prewitt and Sobel
- Conclusion
- Pros
- Simple to understand
- Simple to implement
- Fast
- Cons
- Produce wide edges
- Used a lot! (most common Sobel)
17Edge Detector Laplacian
18Edge Detector Laplacian
- Where exactly is the edge (width)?
- Second-order derivative
- The variation of the variation of the gray-level
value! - How fast does the gradient change?
- Find the zero-crossing
- Center of edge
Prewitt and Sobel
0
Zero-crossing
19(No Transcript)
20Edge Detector Laplacian
- The second-order derivative is very sensitive to
noise!
21Laplacian of Gaussian
- Solution
- Combined with a 2D Gaussian smoothing filter
- (show blobs-to-edge, 32-bit, gauss, convolution,
plot profile)
22Examples
- Gauss filter width
- 5x5 pixels
- 9x9 pixels
- 12x12 pixels
Input
Gauss conv.
Edges
23Laplacian of Gaussian
- Conclusion
- Pros
- Edges well-defined due to zero-crossings
- Cons
- How do we find the zero-crossings?
- I.e., transitions from black to white and vice
versa - Laplacian is too sensitive to noise due to
second-order derivative - Simple to implement except for the search for
zero-crossings! - Not used so often
24Canny Edge Detector
25Canny Edge Detector
- Noise reduction
- 2D Gaussian used for smoothing
- Edge enhancement
- Magnitude of gradient vector
- Edge localisation
26Canny Edge Detector
- Edge localisation
- Wide edges
- Edges give rise to ridges in the gradient image
- Thin edges using the principle of non-maximal
suppression - Find gradients directions
- Each pixel is compared with its two
- neighbors in the gradient direction. The
- two smallest are suppressed gt set to zero
- The result is pixel-thin edges
27Thresholding Dilemma
- Define a threshold in the magnitude-image
- Assume high magnitudes originate from
object-edges - Dilemma (Show blobs-to-edge, edge, dilate(3),
TH) - Too high threshold
- Remove noise ?
- Remove small edges ?
- Too low threshold
- Keep noise ?
- Keep small edges ?
- How do we threshold the magnitude image so that
noise is suppressed and the object-edges are
not???
28Hysteresis Thresholding
- Concept think of object-edges as a connected
group of edge pixels - Use two thresholds Thmin and Thmax
- All magnitude edge-pixel below Thmin are sat to
zero - Choose Thmin so low that no object edges are
eliminated - Find all grouped edges (non-zero edge-pixels)
- Ignore all groups which are too small (in number)
- Ignore all groups which do not contain at least
one edge-pixel with a magnitude above Thmax - Choose Thmax so high that (most) noise edges are
eliminated - Similar to region growing
- Effect
- Isolated (noise) edge-pixels are ignored
- Both strong and weak edge-pixels are kept
29 Examples
Gauss 5x5, Thmax 255, Thmin 1
Gauss 5x5, Thmax 255, Thmin 220
Gauss 5x5, Thmax 128, Thmin 1
Gauss 9x9, Thmax 128, Thmin 1
30Examples
Gauss 7x7, Thmax 200, Thmin 1
Gauss 5x5, Thmax 200, Thmin 1
31Examples
- Comparison on noisy image
Canny
Sobel
32Canny edge detector
- Conclusion
- Pros
- One pixel wide edges
- Edges are grouped together (often good for
segmentation) - Robust against noise!
- Cons
- Complicated to understand and implement
- Slow
- Used a lot!
33What to remember
- Edge Rapid intensity change
- Edge information is an important factor in Image
Procesing and Human Vision - Three steps in edge detection
- Noise reduction
- Edge enhancement
- Edge localisation
- Three types were presented
- Based on first-order derivative
- Prewitt and Sobel
- Based on second-order derivative
- Laplacian of Gaussian
- Based on groups of edges
- Canny
34Exercises
- Use ImageJ to generate a magnitude image using
the Sobel kernels - Discuss the PE-questions
- How wide will the edges be for the different edge
detectors? - Does this matter?
- Discuss the principle of non-maximal suppression