24
1 Segmentation (2): edge detection

1 Segmentation (2): edge detection. 2 Edge-based segmentation A large group of methods based on information about previously detected edges in the image

Embed Size (px)

Citation preview

1

Segmentation (2): edge detection

2

Edge-based segmentation

A large group of methods based on information about previously detected edges in the image

Preprocessing step: edge detection Motivation: images resulted from edge

detection cannot be used as a segmentation result

Edges have to be linked into chains which correspond better with boundaries in an image

Final result: detection of boundaries of objects present in the image

3

Edge detection with DOG and LOG

4

Edge-based segmentation (cont’d)

Task-oriented: embedding prior information (e.g. shape) into the chain forming process

Most common problems: - false detections: edge presence in a

location where there is no border - missed detections: no edge presence

where a real border exists - selecting an appropriate threshold for the

gradient image; this threshold separates significant from non-significant edge information; alternative?

5

Edge-based segmentation

Goal: Connect edges to produce object contours

Approaches: thresholding with hysteresis edge relaxation edge linking fitting: the Hough transform

6

Edge thresholding

Thresholding the gradient magnitude:

{(x, y) : E(x, y) = 1} the set of edge pixels Problem: No guarantees of continuity Alternatives : thresholding with hysteresis edge relaxation

7

Edge thresholding with hysteresis

Thresholding with hysteresis uses two thresholds:

First identify all definite edge pixels. Then, add all “maybe” pixels (those greater than

t0) only if they are next to an already-labeled edge pixel.

Repeat until convergence.

8

Edge relaxation

Local processing Evaluates the strength of edges in a local

neighborhood for increasing and decreasing the confidence of an edge candidate

Contextual information: a ‘weak’ edge positioned between two ‘strong’ edges should probably be part of a boundary.

Isolated edges do not have supporting context, thus probably do not belong to any border.

Edge context is considered at both ends of an edge in a specified edge neighborhood.

9

Edge relaxation (cont’d)

Central edge e has a vertex at each of its ends and three possible border continuations can be found from both of these vertices

10

Edge relaxation (cont’d)

11

Edge linking

Link adjacent edge pixels by seeing if they have similar

properties: 1. Similar magnitude: for some magnitude difference threshold T. 2. Similar orientation

for some angular threshold A.

Once the links established, the sets of linked pixels (chains) can be thought as borders.

Chain linking: postprocessing step to find sets of linked pixels that are separated by small gaps; small gaps can be filled in.

12

Edge linking: Tracing borders of known regions

In some cases, we may already have an image segmented into regions for which we want to calculate boundaries.

In this case, we can simply generate the boundaries by tracing around the region contours. We can do this two ways:

Sequential tracing: Trace around each contour in the image. When we finish tracing one contour, scan the image until we run into another.

Simultaneous tracing: Make one pass through the image, using appropriate data structures to represent the progress of each contour tracing and adding pixels to the appropriate contour as encountered.

13

Fitting: The Hough Transform

The Hough transform is useful for grouping isolated edge points into image structures (patterns, models)

Edges to be grouped are not necessarily adjacenct, connected or close.

The Hough transform requires a parametric representation of the primitive (or model) of interest in the image.

Most simple primitive: a line

14

The Hough Transform for line detection

Consider one edge point (x,y) There is an infinity of lines passing through this

point. Parametric representation of such lines (slope-

intercept form):

For all lines that pass through a given point (x,y), there is a unique value of b for m.

The set of (m,b) values corresponding to the lines passing through point (x,y) form a line in (m,b) space.

15

The Hough transform: correspondence between image and parameter space

Every point in image space (x,y) corresponds to a line in the parameter space (m,b).

Vice versa, every point in parameter space (m,b) corresponds to a line in image space.

16

The Hough transform: accumulator

The Hough transform lets each point in the image space (x,y) vote in the (m,b) space for each point passing through it.

The votes are summarized into an accumulator. We have to limit the number of votes → discretize

the parameter space

17

The Hough transform: alternate representation

The slope-intercept form of a line cannot represent vertical lines : both m, b→

Another way is expressing a line in (, ) form

Each point in the image space votes for a sinusoid of points in the accumulator. High accumulator values are where sinusoids cross.

Finding maxima in the accumulator still equates to finding lines in the image space.

18

The Hough algorithm

1. Find all of the desired feature points (i.e. edges) in the image

2. For each feature point xi: 3. For each possibility (line, sinusoid) pj in

the accumulator that passes through the feature point:

4. Increment that position in the accumulator

5. Find maxima in the accumulator6. If desired, map each maximum in

the accumulator back to image space

19

Hough transform: an example

Initial image: two partially occluding rectangles

Edges detected with Canny

Canny detects well the overall boundaries in the image, but this result tells us nothing about the identity (and quantity) of primitives within this boundary description.

20

Hough transform: an example (cont’d)

Hough transform Contrast enhancement

21

Hough transform: an example

Mapping back from the parameter space into the image space yields a set of line descriptions of the image.

Hough transform found the 8 sides of the two rectangles.

22

23

Hough transform for circles

Parametric representation of a circle:

Three parameters: center (xc, yc) and radius r

Only two parameters if size r is known Same idea: each feature point votes for

each circle it could be on. The accumulator is 3D.

24

The generalized Hough transform

The Hough Transform can be extended to any parametrically defined shape (lines, circles, ellipses etc.)

Problem: as the number of parameters increases, so does the dimensionality of the parameter space

Computational complexity goes up exponentially with the number of parameters