You are here: Start » Filter Reference » Computer Vision » Line Finder » ExtendSegmentFromPoint
ExtendSegmentFromPoint
| Module: | MetrologyPro |
|---|
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.
Applications
| Name | Type | Range | Description | |
|---|---|---|---|---|
![]() |
inImage | Image | Input image (gradient is computed in-place) | |
![]() |
inPoint | Point2D | Starting point, expected to lie on or near the line | |
![]() |
inEdgeThreshold | Real | 0.0 - ![]() |
Minimum Sobel gradient magnitude required to continue extending |
![]() |
inRelativeThreshold | Real | 0.0 - 1.0 | Candidate magnitude must be at least this fraction of the running average magnitude |
![]() |
inRoi | Rectangle2D* | Optional rectangle that limits pixel tracking to a specific area | |
![]() |
outSegment | Segment2D | Resulting segment spanning the detected line through inPoint | |
![]() |
outTrackedPoints | Point2DArray | Pixel centres visited during tracking, in processing order | |
Description
The operation starts from inPoint, which is expected to lie on or near an edge, and walks in both directions along the locally estimated edge direction one pixel at a time. At each step, two integer-valued pixel candidates straddling the current path perpendicularly are evaluated; the one with the higher Sobel gradient magnitude is chosen. The direction estimate is updated at each step by averaging with the local edge direction. Extension stops when the gradient at the next position falls below inEdgeThreshold, when the gradient falls below inRelativeThreshold × the running average, or when the image boundary (or inRoi) is reached.
Hints
- Supply a point from a prior detection step (e.g. from ScanSingleEdge or FindSingleEdge) as inPoint.
- Set inEdgeThreshold to match the expected edge contrast. Values between 5 and 15 work for most natural edges under moderate noise.
- Use inRelativeThreshold to stop extension when the gradient fades near the true endpoint, preventing the path from drifting along background noise after the edge ends.
- Connect outTrackedPoints during development to visualize the pixel-level walking path.
Complexity Level
This filter is available on Advanced Complexity Level.
See Also
- 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.
- FindSingleEdge

Advanced

