Back to Aurora Vision Library website
You are here: Start » Function Reference » Computer Vision » Line Finder » ExtendSegment
ExtendSegment
| Header: | AVL.h |
|---|---|
| Namespace: | avl |
| Module: | MetrologyPro |
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
void avl::ExtendSegment ( const avl::Image& inImage, const avl::Segment2D& inSegment, float inEdgeThreshold, avl::InterpolationMethod::Type inInterpolation, avl::Segment2D& outSegment )
Parameters
| Name | Type | Range | Default | Description | |
|---|---|---|---|---|---|
![]() |
inImage | const Image& | Input image (gradient is computed in-place) | ||
![]() |
inSegment | const Segment2D& | Segment to extend | ||
![]() |
inEdgeThreshold | float | 0.0 - ![]() |
10.0f | Minimum Sobel gradient magnitude required to continue extending |
![]() |
inInterpolation | InterpolationMethod::Type | Bilinear | NearestNeighbour snaps the walking position to the integer grid; Bilinear samples all Sobel neighbours at real-valued coordinates | |
![]() |
outSegment | Segment2D& | Extended segment |
Description
The operation extends inSegment at both endpoints by walking one pixel at a time along the segment direction. At each step the Sobel gradient magnitude is sampled at the new position. Extension stops when the magnitude falls below inEdgeThreshold or the image boundary is reached.
Hints
- Apply after a segment detector (e.g. FindSingleEdge) to recover the full length of an edge when the initial detection stops short of the true endpoint.
- Use inInterpolation = Bilinear for sub-pixel sampling accuracy at oblique orientations. NearestNeighbour snaps the walking position to the integer grid and is faster but less accurate.
- Set inEdgeThreshold to the minimum acceptable gradient magnitude at the extended endpoints. Lower values allow extension further into faint edge regions; higher values stop earlier.
See Also
- ExtendSegmentFromPoint – Builds a segment from a single point on a line by walking in both directions along the locally estimated line direction, one pixel at a time.
- FindSingleEdge



