close_edgesclose_edgesCloseEdgesCloseEdgesclose_edges (Operator)

Name

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

static void HOperatorSet.CloseEdges(HObject edges, HObject edgeImage, out HObject regionResult, HTuple minAmplitude)

HRegion HRegion.CloseEdges(HImage edgeImage, int minAmplitude)

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

Description

close_edgesclose_edgesCloseEdgesCloseEdgesCloseEdgesclose_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 MinAmplitudeMinAmplitudeMinAmplitudeMinAmplitudeminAmplitudemin_amplitude. This operator expects as input the edges (EdgesEdgesEdgesEdgesedgesedges) and amplitude image (EdgeImageEdgeImageEdgeImageEdgeImageedgeImageedge_image) returned by typical edge operators, such as edges_imageedges_imageEdgesImageEdgesImageEdgesImageedges_image or sobel_ampsobel_ampSobelAmpSobelAmpSobelAmpsobel_amp. close_edgesclose_edgesCloseEdgesCloseEdgesCloseEdgesclose_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

Parameters

EdgesEdgesEdgesEdgesedgesedges (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Region containing one pixel thick edges.

EdgeImageEdgeImageEdgeImageEdgeImageedgeImageedge_image (input_object)  singlechannelimage objectHImageHObjectHImageHobject (byte / uint2 / int4)

Edge amplitude (gradient) image.

RegionResultRegionResultRegionResultRegionResultregionResultregion_result (output_object)  region(-array) objectHRegionHObjectHRegionHobject *

Region containing closed edges.

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

Minimum edge amplitude.

Default value: 16

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

Typical range of values: 1 ≤ MinAmplitude MinAmplitude MinAmplitude MinAmplitude minAmplitude min_amplitude ≤ 255

Minimum increment: 1

Recommended increment: 1

Restriction: MinAmplitude >= 0

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

Possible Predecessors

edges_imageedges_imageEdgesImageEdgesImageEdgesImageedges_image, sobel_ampsobel_ampSobelAmpSobelAmpSobelAmpsobel_amp, thresholdthresholdThresholdThresholdThresholdthreshold, skeletonskeletonSkeletonSkeletonSkeletonskeleton

Possible Successors

skeletonskeletonSkeletonSkeletonSkeletonskeleton

Alternatives

close_edges_lengthclose_edges_lengthCloseEdgesLengthCloseEdgesLengthCloseEdgesLengthclose_edges_length, dilation1dilation1Dilation1Dilation1Dilation1dilation1, closingclosingClosingClosingClosingclosing

See also

gray_skeletongray_skeletonGraySkeletonGraySkeletonGraySkeletongray_skeleton

Module

Foundation