Skip to content

close_edgesCloseEdgesCloseEdgesclose_edgesclose_edges🔗

Short description🔗

close_edgesCloseEdgesCloseEdgesclose_edgesclose_edges — Close edge gaps using the edge amplitude image.

Signature🔗

close_edges( region Edges, image EdgeImage, out region RegionResult, integer MinAmplitude )void CloseEdges( const HObject& Edges, const HObject& EdgeImage, HObject* RegionResult, const HTuple& MinAmplitude )static void HOperatorSet.CloseEdges( HObject edges, HObject edgeImage, out HObject regionResult, HTuple minAmplitude )def close_edges( edges: HObject, edge_image: HObject, min_amplitude: int ) -> HObject

Herror close_edges( const Hobject Edges, const Hobject EdgeImage, Hobject* RegionResult, const Hlong MinAmplitude )

Herror T_close_edges( const Hobject Edges, const Hobject EdgeImage, Hobject* RegionResult, const Htuple MinAmplitude )

HRegion HRegion::CloseEdges( const HImage& EdgeImage, Hlong MinAmplitude ) const

HRegion HRegion.CloseEdges( HImage edgeImage, int minAmplitude )

Description🔗

close_edgesCloseEdges closes gaps in the output of an edge detector, and thus tries to produce complete object contours. This is done by examining the neighbors of each edge point to determine the point with maximum amplitude (i.e., maximum gradient), and adding the point to the edge if its amplitude is larger than the minimum amplitude passed in MinAmplitudeminAmplitudemin_amplitude. This operator expects as input the edges (Edgesedgesedges) and amplitude image (EdgeImageedgeImageedge_image) returned by typical edge operators, such as edges_imageEdgesImage or sobel_ampSobelAmp. close_edgesCloseEdges does not take into account the edge directions that may be returned by an edge operator. Thus, in areas where the gradient is almost constant the edges may become rather “wiggly.”

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.

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

Edge amplitude (gradient) image.

RegionResultregionResultregion_result (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: 1 ≤ MinAmplitude
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(ThinEdge,EdgeAmp,&CloseEdges,15)\;
skeleton(CloseEdges,&ThinCloseEdges)\;

Result🔗

close_edgesCloseEdges 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

Possible successors

skeletonSkeleton

Alternatives

close_edges_lengthCloseEdgesLength, dilation1Dilation1, closingClosing

See also

gray_skeletonGraySkeleton

Module🔗

Foundation