ExtendSegment


Extends a segment at both endpoints by walking 1 pixel at a time along the segment direction, stopping when the in-place Sobel gradient magnitude at the next position drops below threshold or the image boundary is reached.

Applications:Refining a segment detected by a line finding tool to its full length within the image.

Syntax

C++
C#
Python
 
def ExtendSegment(
	inImage: Image,
	inSegment: Segment2D,
	inEdgeThreshold: float,
	inInterpolation: InterpolationMethod,
	/
)
-> outSegment: Segment2D

Parameters

Name Type Range Default Description
Input value inImage Image Input image (gradient is computed in-place)
Input value inSegment Segment2D Segment to extend
Input value inEdgeThreshold float 0.0 - Minimum Sobel gradient magnitude required to continue extending
Input value inInterpolation InterpolationMethod NearestNeighbour snaps the walking position to the integer grid; Bilinear samples all Sobel neighbours at real-valued coordinates
Output value outSegment Segment2D Extended segment