Consistent gradient


The SegmentFinder step uses edge-extraction techniques to search for segments along contours. The extracted segment angle (direction) is perpendicular to the contour's gradient angle (the direction of the steepest change from dark to light causing the edge). Therefore, the segment's angle is the angle of the gradient minus 90°.

The SegmentFinder step only finds segment occurrences with consistent angles when Consistent gradient is enabled (default). In other words, when Consistent gradient is enabled, the polarity across a segment must remain consistent. When Consistent gradient is disabled, the SegmentFinder step finds segment occurrences regardless of their gradient transitions. The following animation illustrates how the Consistent gradient property influences what is returned as an occurrence.

When searching for segments in an image with lines, each line is counted as 2 occurrences with opposite angles. You can restrict what is returned to one occurrence by disabling the Minimum separation angle property. The following example illustrates which occurrences are found when Minimum separation angle is enabled or disabled.

For more information on separation, see the Separation subsection of the Separation and shared edges section in Chapter 13: ModelFinder step.