FindSingleLine


Finds a single straight line within a rectangular scan field.

Applications:Detection of a single straight line in the presence of multiple competing lines or noisy backgrounds.

Syntax

C++
C#
Python
 
def FindSingleLine(
	inImage: Image,
	inScanField: SegmentScanField,
	/,
	*,
	inScanFieldAlignment: CoordinateSystem2D | None = None,
	inScanWidth: int = 5,
	inScanStep: int = 10,
	inScanLimit: int = 50,
	inEdgeScanParams: EdgeScanParams = EdgeScanParams(ProfileInterpolationMethod.Quadratic4, 0.6, 5.0, EdgeTransition.Any),
	inPointBlindness: float = 0.3,
	inMaxSlant: float = 30.0,
	inMinLength: float = 10.0,
	inMaxGap: float = 50.0,
	inMinPointCount: int = 3,
	inLineSelection: LineSelection = LineSelection.Fittest,
	inLineBlindness: float = 0.4,
	inEdgeMeasure: EdgeMeasure = EdgeMeasure.LogMagnitude,
	inLineFinderMethod: LineFinderMethod = LineFinderMethod.Hough,
	inMaxPointDeviation: float = 2.5,
	inMaxTurnAngle: float = 10.0,
	inOutlierSuppression: LineMEstimator | None = LineMEstimator.TheilSen,
	inRefineEndpoints: bool = True,
	outAlignedScanField: SegmentScanField | None = None
)
-> (
	outLine: Segment2D | None,
	outLineStrength: float,
	outResponseProfiles: list[Profile],
	outSelectedPoints: list[Point2D],
	diagScanLines: list[Segment2D],
	diagCandidatePoints: list[Point2D]
)

Parameters

Name Type Range Default Description
Input value inImage Image Input image
Input value inScanField SegmentScanField Region where the scans are performed
Input value inScanFieldAlignment CoordinateSystem2D | None None
Input value inScanWidth int 1 - 5 How many pixels are sampled perpendicularly at each scan line's positions
Input value inScanStep int 1 - 10 Pixel distance between the centers of consecutive scan lines
Input value inScanLimit int 1 - 50 Maximum number of scan lines
Input value inEdgeScanParams EdgeScanParams EdgeScanParams(ProfileInterpolationMethod.Quadratic4, 0.6, 5.0, EdgeTransition.Any) Parameters of 1D edge detection along a single scan line
Input value inPointBlindness float 0.0 - 1.0 0.3 Defines a threshold for rejecting edge points that are weaker than a certain portion of the strongest edge point
Input value inMaxSlant float 0.0 - 45.0 30.0 Maximum angle deviation of the resulting line from 90 degrees to the scan axis
Input value inMinLength float 0.0 - 10.0 Minimum length of the resulting line
Input value inMaxGap float 0.0 - 50.0 Maximum gap within a resulting line
Input value inMinPointCount int 2 - 3 Minimum number of edge points that a resulting line must contain (otherwise it is rejected)
Input value inLineSelection LineSelection LineSelection.Fittest Selection criteria for edge lines
Input value inLineBlindness float 0.0 - 1.0 0.4 Defines a threshold for rejecting entire lines that are weaker than a certain portion of the strongest line
Input value inEdgeMeasure EdgeMeasure EdgeMeasure.LogMagnitude Several options for measuring a single edge point
Input value inLineFinderMethod LineFinderMethod LineFinderMethod.Hough Several alternative algorithms for finding lines within the detected cloud of edge points
Input value inMaxPointDeviation float 0.0 - 2.5 Maximum pixel distance between a detected line and its supporting edge points
Input value inMaxTurnAngle float 0.0 - 90.0 10.0 Maximum turn angle at any interior vertex of the line path
Input value inOutlierSuppression LineMEstimator | None LineMEstimator.TheilSen A method for removing outlying points
Input value inRefineEndpoints bool True Turns on a method for refining the length of the detected line
Output value outLine Segment2D | None
Output value outLineStrength float
Output value outResponseProfiles list[Profile] Edge response profiles, one per scan line
Output value outAlignedScanField SegmentScanField | None None
Output value outSelectedPoints list[Point2D] List of points associated with the returned line
Diagnostic input diagScanLines list[Segment2D]
Diagnostic input diagCandidatePoints list[Point2D]

Hardware Acceleration

This operation supports automatic parallelization for multicore and multiprocessor systems.