You are on page 1of 42

CSE 483: Computer Vision

Image Segmentation

Prof. Mahmoud Khalil


1
Segmentation Goals
Goal: identify groups of pixels that go together

2
3
Image Segmentation – Point Detection

4
Image Segmentation – Line Detection

5
Image Segmentation – Line Detection

6
Image Segmentation – Edge Detection

7
Image Segmentation – Edge Detection

8
Image Segmentation – Edge Detection

9
Edge Detection (Gradient Operators)

10
Edge Detection (Gradient Operators)

11
Partial Derivatives of an Image

12
Image Gradient

13
Designing an Edge Detector

14
Derivative Theorem of Convolution

15
Edge by Derivative of Gaussian

16
Laplacian of Gaussian

17
2D Edge Detection Filters

Source: Steve Seitz 18


Smoothing with a Gaussian

Source: Kristen Grauman, UT-Austin 19


Effect of σ on derivatives

Source: Kristen Grauman, UT-Austin 20


Edge Detection
• Criteria for optimal edge detection (Canny 86):
• Good detection:
• minimize the probability of false positives (detecting spurious
edges caused by noise),
• false negatives (missing real edges)
- Good localization:
• edges must be detected as close as possible to the true edges.
- Single response constraint:
• minimize the number of local maxima around the true edge (i.e.
detector must return single point for each true edge point)

21
Edge Detection
• Examples:

22
Canny Edge Detector
• Smooth by Gaussian
x2  y2
S  G * I 1 
G  e 2 2

2 
• Compute x and y derivatives
T
  
S   S S   Sx  Sy 
T

 x y 
• Compute gradient magnitude and orientation

S  S x2  S y2

Sy
  tan 1

Sx
23
Canny Edge Operator

S  G * I   G * I
T
 G G 
G  
 x y 

T
 G G 
S   *I *I
 x y 

24
Canny Edge Detector
Sx

Sy

25
Non‐maximum suppression for each orientation
At q, we have a
maximum if the
value is larger
than those at both
p and at r.
Interpolate to get
these values.

Source: D. Forsyth 26
Edge linking
Assume the marked point
is an edge point. Then we
construct the tangent to the
edge curve (which is
normal to the gradient at
that point) and use this to
predict the next points
(here either r or s).

Source: D. Forsyth 27
Non‐Maximum Suppression Examples

Source: D. Forsyth 28
Thresholding

Source: D. Forsyth High Threshold (Strong Edges) Small Threshold (Weak Edges) 29
Hysteresis thresholding
• Use a high threshold
to start edge curves
and a low threshold
to continue them.

Source: S. Seitz 30
Hysteresis Thresholding

31
Hysteresis Thresholding

Source: L. Fei-Fei 32
Canny edge detector
1. Filter image with x, y derivatives of Gaussian
2. Find magnitude and orientation of gradient
3. Non‐maximum suppression:
• Thin multi‐pixel wide “ridges” down to single pixel width
4. Thresholding and linking (hysteresis):
• Define two thresholds: low and high
• Use the high threshold to start edge curves and the low threshold to continue them

• MATLAB: edge(image, ‘canny’)


33
Effect of  (Gaussian kernel spread/size)

original Canny with Canny with

The choice of  depends on desired behavior


• large  detects large scale edges
• small  detects fine features
34
Low‐level Edges vs. Perceived Contours

Source: L. Lazebnik
35
Thresholding

42
Global Thresholding

43
Global Thresholding

44
The Role of Illumination

45
Adaptive Thresholding

46
Adaptive Thresholding

47
Optimal Global Adaptive Thresholding

48

You might also like