Skip to content

close_edges_lengthCloseEdgesLengthCloseEdgesLengthclose_edges_lengthclose_edges_length🔗

Short description🔗

close_edges_lengthCloseEdgesLengthCloseEdgesLengthclose_edges_lengthclose_edges_length — Close edge gaps using the edge amplitude image.

Signature🔗

close_edges_length( region Edges, image Gradient, out region ClosedEdges, integer MinAmplitude, integer MaxGapLength )void CloseEdgesLength( const HObject& Edges, const HObject& Gradient, HObject* ClosedEdges, const HTuple& MinAmplitude, const HTuple& MaxGapLength )static void HOperatorSet.CloseEdgesLength( HObject edges, HObject gradient, out HObject closedEdges, HTuple minAmplitude, HTuple maxGapLength )def close_edges_length( edges: HObject, gradient: HObject, min_amplitude: int, max_gap_length: int ) -> HObject

Herror close_edges_length( const Hobject Edges, const Hobject Gradient, Hobject* ClosedEdges, const Hlong MinAmplitude, const Hlong MaxGapLength )

Herror T_close_edges_length( const Hobject Edges, const Hobject Gradient, Hobject* ClosedEdges, const Htuple MinAmplitude, const Htuple MaxGapLength )

HRegion HRegion::CloseEdgesLength( const HImage& Gradient, Hlong MinAmplitude, Hlong MaxGapLength ) const

HRegion HRegion.CloseEdgesLength( HImage gradient, int minAmplitude, int maxGapLength )

Description🔗

close_edges_lengthCloseEdgesLength closes gaps in the output of an edge detector, and thus tries to produce complete object contours. This operator expects as input the edges (Edgesedgesedges) and amplitude image (Gradientgradientgradient) returned by typical edge operators, such as edges_imageEdgesImage or sobel_ampSobelAmp.

Contours are closed in two steps: First, one pixel wide gaps in the input contours are closed, and isolated points are eliminated. After this, open contours are extended by up to MaxGapLengthmaxGapLengthmax_gap_length points by adding edge points until either the contour is closed or no more significant edge points can be found. A gradient is regarded as significant if it is larger than MinAmplitudeminAmplitudemin_amplitude. The neighboring points examined as possible new edge points are the point in the direction of the contour and its two adjacent points in an 8-neighborhood. For each of these points, the sum of its gradient and the maximum gradient of that points three possible neighbors is calculated (look ahead of length 1). The point with the maximum sum is then chosen as the new edge point.

Attention🔗

Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

Parameters🔗

Edgesedgesedges (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Region containing one pixel thick edges.

Gradientgradientgradient (input_object) singlechannelimage → object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

Edge amplitude (gradient) image.

ClosedEdgesclosedEdgesclosed_edges (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

Region containing closed edges.

MinAmplitudeminAmplitudemin_amplitude (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Minimum edge amplitude.

Default: 1616
Suggested values: 5, 8, 10, 12, 16, 20, 25, 30, 40, 505, 8, 10, 12, 16, 20, 25, 30, 40, 50
Value range: 0 ≤ MinAmplitude ≤ 255
Minimum increment: 1
Recommended increment: 1

MaxGapLengthmaxGapLengthmax_gap_length (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Maximal number of points by which edges are extended.

Default: 33
Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30, 40, 50, 70, 1001, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30, 40, 50, 70, 100
Value range: 1 ≤ MaxGapLength ≤ 127
Minimum increment: 1
Recommended increment: 1

Example🔗

(C)

sobel_amp(Image,&EdgeAmp,"sum_abs",5)\;
threshold(EdgeAmp,&EdgeRegion,40.0,255.0)\;
skeleton(EdgeRegion,&ThinEdge)\;
close_edges_length(ThinEdge,EdgeAmp,&CloseEdges,15,3)\;

Result🔗

close_edges_lengthCloseEdgesLength returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behavior can be set via set_system('no_object_result',<Result>). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

edges_imageEdgesImage, sobel_ampSobelAmp, thresholdThreshold, skeletonSkeleton

Alternatives

close_edgesCloseEdges, dilation1Dilation1, closingClosing

References🔗

M. Üsbeck: “Untersuchungen zur echtzeitfähigen Segmentierung”; Studienarbeit, Bayerisches Forschungszentrum für Wissensbasierte Systeme (FORWISS), Erlangen, 1993.

Module🔗

Foundation