Operator Reference

close_edgesclose_edgesCloseEdgesCloseEdgesclose_edges (Operator)

close_edgesclose_edgesCloseEdgesCloseEdgesclose_edges — Close edge gaps using the edge amplitude image.

Signature

close_edges(Edges, EdgeImage : RegionResult : MinAmplitude : )

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)

void CloseEdges(const HObject& Edges, const HObject& EdgeImage, HObject* RegionResult, const HTuple& MinAmplitude)

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

def close_edges(edges: HObject, edge_image: HObject, min_amplitude: int) -> HObject

Description

close_edgesclose_edgesCloseEdgesCloseEdgesclose_edges 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 MinAmplitudeMinAmplitudeMinAmplitudeminAmplitudemin_amplitude. This operator expects as input the edges (EdgesEdgesEdgesedgesedges) and amplitude image (EdgeImageEdgeImageEdgeImageedgeImageedge_image) returned by typical edge operators, such as edges_imageedges_imageEdgesImageEdgesImageedges_image or sobel_ampsobel_ampSobelAmpSobelAmpsobel_amp. close_edgesclose_edgesCloseEdgesCloseEdgesclose_edges 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

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Automatically parallelized on tuple level.

Parameters

EdgesEdgesEdgesedgesedges (input_object)  region(-array) objectHRegionHObjectHObjectHobject

Region containing one pixel thick edges.

EdgeImageEdgeImageEdgeImageedgeImageedge_image (input_object)  singlechannelimage objectHImageHObjectHObjectHobject (byte / uint2 / int4)

Edge amplitude (gradient) image.

RegionResultRegionResultRegionResultregionResultregion_result (output_object)  region(-array) objectHRegionHObjectHObjectHobject *

Region containing closed edges.

MinAmplitudeMinAmplitudeMinAmplitudeminAmplitudemin_amplitude (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Minimum edge amplitude.

Default: 16

Suggested values: 5, 8, 10, 12, 16, 20, 25, 30, 40, 50

Value range: 1 ≤ MinAmplitude MinAmplitude MinAmplitude minAmplitude min_amplitude

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_edgesclose_edgesCloseEdgesCloseEdgesclose_edges 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>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>). If necessary, an exception is raised.

Possible Predecessors

edges_imageedges_imageEdgesImageEdgesImageedges_image, sobel_ampsobel_ampSobelAmpSobelAmpsobel_amp, thresholdthresholdThresholdThresholdthreshold, skeletonskeletonSkeletonSkeletonskeleton

Possible Successors

skeletonskeletonSkeletonSkeletonskeleton

Alternatives

close_edges_lengthclose_edges_lengthCloseEdgesLengthCloseEdgesLengthclose_edges_length, dilation1dilation1Dilation1Dilation1dilation1, closingclosingClosingClosingclosing

See also

gray_skeletongray_skeletonGraySkeletonGraySkeletongray_skeleton

Module

Foundation