Page 252 -
P. 252
4.5 Exercises 231
struct SEdgel {
float e[2][2]; // edgel endpoints (zero crossing)
float x, y; // sub-pixel edge position (midpoint)
float n_x, n_y; // orientation, as normal vector
float theta; // orientation, as angle (degrees)
float length; // length of edgel
float strength; // strength of edgel (gradient magnitude)
};
struct SLine : public SEdgel {
float line_length; // length of line (est. from ellipsoid)
float sigma; // estimated std. dev. of edgel noise
float r; // line equation: x * n_y-y * n_x=r
};
Figure 4.48 A potential C++ structure for edgel and line elements.
Ex 4.8: Edge linking and thresholding Link up the edges computed in the previous exer-
cise into chains and optionally perform thresholding with hysteresis.
The steps may include:
1. Store the edgels either in a 2D array (say, an integer image with indices into the edgel
list) or pre-sort the edgel list first by (integer) x coordinates and then y coordinates, for
faster neighbor finding.
2. Pick up an edgel from the list of unlinked edgels and find its neighbors in both direc-
tions until no neighbor is found or a closed contour is obtained. Flag edgels as linked
as you visit them and push them onto your list of linked edgels.
3. Alternatively, generalize a previously developed connected component algorithm (Ex-
ercise 3.14) to perform the linking in just two raster passes.
4. (Optional) Perform hysteresis-based thresholding (Canny 1986). Use two thresholds
”hi” and ”lo” for the edge strength. A candidate edgel is considered an edge if either
its strength is above the ”hi” threshold or its strength is above the ”lo” threshold and it
is (recursively) connected to a previously detected edge.
5. (Optional) Link together contours that have small gaps but whose endpoints have sim-
ilar orientations.
6. (Optional) Find junctions between adjacent contours, e.g., using some of the ideas (or
references) from Maire, Arbelaez, Fowlkes et al. (2008).
Ex 4.9: Contour matching Convert a closed contour (linked edgel list) into its arc-length
parameterization and use this to match object outlines.
The steps may include: