gen_contour2_xld ( EdgeRegion : Contours : Length, Mode : )

Convert a region into XLD contours.

gen_contour_xld converts the input region EdgeRegion, which is assumed to contain mostly one pixel wide regions (see skeleton), into an XLD contour. The regions are first transformed to contain only line segments in 8-neighborhood. In the process 12 special configurations are taken into account: Points for which there is a junction of three or more lines in 8-neighborhood are preserved (in all four rotations):

  0  0  1     0  1  0     0  1  0
  1  1  0     0  1  1     1  1  1
  0  1  0     0  1  0     0  1  0
In a second step, all junction points are labeled, taking six different characteristic configurations in all four possible rotations into account:
  1  0  1     1  0  1     1  0  0     1  0  0     0  1  0     0  1  0
  0  2  0     0  2  0     0  2  1     0  2  1     0  2  1     1  2  1
  0  0  1     1  0  1     0  1  0     1  0  0     0  1  0     0  1  0
where 0 = background, 1 = foreground, and 2 = junction point.

After this, all contours having at least Length points are returned. In contrast to gen_contour_xld, the contours generated by gen_contour2_xld always end in junction or end points. For closed contours the first point lies in the 8-neighborhood of the last point of the contour. Therefore, in order to determine the adjacency of contours it is sufficient to just take the end points into account.

Since contours are split at junction points, possibly long contours may be split into several short segments because of short adjacent lines, even if they are longer than Length points, if Mode = 'filter' was selected. This is avoided by setting Mode = 'generalize1'. In this case, the contours are generated as if the segments shorter than Length were not contained in the input region. In order to preserve line segments, which are split into very short segments by the crossing of short lines, Mode = 'generalize2' can be selected. In this case, line segments are preserved is they end in two junction points, even if they are shorter than Length.


Parameters

EdgeRegion (input_object)
region -> object
Skeleton of which the contours are to be determined.

Contours (output_object)
xld_cont-array -> object
Resulting contours.

Length (input_control)
integer -> integer
Minimum number of points a contour has to have.
Default value: 1
Suggested values: 1, 2, 3, 5, 10, 20

Mode (input_control)
string -> string
Contour filter mode.
Default value: 'filter'
List of values: 'filter', 'generalize1', 'generalize2'


Possible Predecessors

skeleton


Possible Successors

smooth_cont_xld, get_contour_xld, poly_xld


Alternatives

gen_contour_xld


See also

edges__, threshold__, fetch_contour



Copyright © 1996-1997 MVTec Software GmbH