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 | |
|---|---|---|---|---|---|
![]() |
inImage | Image | Input image (gradient is computed in-place) | ||
![]() |
inSegment | Segment2D | Segment to extend | ||
![]() |
inEdgeThreshold | float | 0.0 - ![]() |
Minimum Sobel gradient magnitude required to continue extending | |
![]() |
inInterpolation | InterpolationMethod | NearestNeighbour snaps the walking position to the integer grid; Bilinear samples all Sobel neighbours at real-valued coordinates | ||
![]() |
outSegment | Segment2D | Extended segment |



