Back to Aurora Vision Library website

You are here: Start » Function Reference » Computer Vision » Line Finder » FindMultipleLines

FindMultipleLines


Header: AVL.h
Namespace: avl
Module: MetrologyPro

Finds multiple straight lines within a rectangular scan field, ordered from highest-scoring to lowest.

Applications: Detection of multiple lines within a single scan field.

Syntax

C++
C#
Python
 
void avl::FindMultipleLines
(
	const avl::Image& inImage,
	const avl::SegmentScanField& inScanField,
	atl::Optional<const avl::CoordinateSystem2D&> inScanFieldAlignment,
	int inScanWidth,
	int inScanStep,
	int inScanLimit,
	const avl::EdgeScanParams& inEdgeScanParams,
	float inPointBlindness,
	float inMaxSlant,
	float inMinLength,
	float inMaxGap,
	int inMinPointCount,
	avl::LineSelection::Type inLineSelection,
	float inLineBlindness,
	avl::EdgeMeasure::Type inEdgeMeasure,
	avl::LineFinderMethod::Type inLineFinderMethod,
	float inMaxPointDeviation,
	float inMaxTurnAngle,
	atl::Optional<avl::LineMEstimator::Type> inOutlierSuppression,
	bool inRefineEndpoints,
	atl::Optional<int> inMaxCount,
	atl::Array<avl::Segment2D>& outLines,
	atl::Array<float>& outLineStrengths,
	atl::Array<avl::Profile>& outResponseProfiles,
	atl::Optional<avl::SegmentScanField&> outAlignedScanField,
	atl::Array<atl::Array<avl::Point2D>>& outSelectedPoints,
	atl::Array<avl::Segment2D>& diagScanLines,
	atl::Array<avl::Point2D>& diagCandidatePoints
)

Parameters

Name Type Range Default Description
Input value inImage const Image& Input image
Input value inScanField const SegmentScanField& Region where the scans are performed
Input value inScanFieldAlignment Optional<const CoordinateSystem2D&> NIL
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 const EdgeScanParams& EdgeScanParams ( ProfileInterpolation: Quadratic4 SmoothingStdDev: 1.2f MinMagnitude: 5.0f EdgeTransition: Any ) Parameters of 1D edge detection along a single scan line
Input value inPointBlindness float 0.0 - 1.0 0.3f 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.0f Maximum angle deviation of the resulting line from 90 degrees to the scan axis
Input value inMinLength float 0.0 - 10.0f Minimum length of the resulting line
Input value inMaxGap float 0.0 - 50.0f 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::Type Fittest Selection criteria for edge lines
Input value inLineBlindness float 0.0 - 1.0 0.4f Defines a threshold for rejecting entire lines that are weaker than a certain portion of the strongest line
Input value inEdgeMeasure EdgeMeasure::Type LogMagnitude Several options for measuring a single edge point
Input value inLineFinderMethod LineFinderMethod::Type Hough Several alternative algorithms for finding lines within the detected cloud of edge points
Input value inMaxPointDeviation float 0.0 - 2.5f Maximum pixel distance between a detected line and its supporting edge points
Input value inMaxTurnAngle float 0.0 - 90.0 10.0f Maximum turn angle at any interior vertex of the line path
Input value inOutlierSuppression Optional<LineMEstimator::Type> TheilSen A method for removing outlying points
Input value inRefineEndpoints bool True Turns on a method for refining the length of the detected line
Input value inMaxCount Optional<int> 1 - 100 Maximum number of lines to return
Output value outLines Array<Segment2D>&
Output value outLineStrengths Array<float>&
Output value outResponseProfiles Array<Profile>& Edge response profiles, one per scan line
Output value outAlignedScanField Optional<SegmentScanField&>
Output value outSelectedPoints Array<Array<Point2D>>& Lists of points associated with each returned line
Diagnostic input diagScanLines Array<Segment2D>& Positions of the scan lines placed within the scan field
Diagnostic input diagCandidatePoints Array<Point2D>& Edge points detected on the scan lines, after inPointBlindness filtering

Optional Outputs

The computation of following outputs can be switched off by passing value atl::NIL to these parameters: outAlignedScanField.

Read more about Optional Outputs.

Description

The operation finds all straight lines within the inScanField and returns them ordered from the highest-scoring to the lowest. It works like FindSingleLine, but iterates the selection: once a line is accepted, its supporting candidate points are excluded from the competition for subsequent lines, so the results are non-overlapping. Up to inMaxCount lines are returned.

Hints

  • Activate diagCandidatePoints and diagScanLines during development to verify that candidates appear on the right scan lines before adjusting higher-level parameters.
  • Adjust inEdgeScanParams.MinMagnitude first: a value that is too high misses real edges; too low fills the result with noise candidates.
  • Increase inScanStep to speed up execution on large scan fields. Keep it small (5–10 px) when the line is short or its position varies rapidly across the field.
  • inPointBlindness suppresses weak per-scan-line candidates relative to the strongest response on that line. A value of 0.3 discards candidates below 30 % of the highest value on that scan line.
  • If a detected segment is shorter than the actual line, try increasing inMaxGap, widening inMaxPointDeviation.
  • Set inMaxSlant to the maximum expected deviation of the line from the direction perpendicular to the scan field axis. Narrowing this range reduces false positives.
  • Use inLineSelection = Fittest for the straightest line, Strongest for the highest-contrast line, and Smoothest for gently curved or slightly wavy lines.
  • Connect inScanFieldAlignment to a coordinate system to automatically adapt the measurement to the object position in each frame.
  • Set inMaxCount to the exact number of parallel lines expected to prevent spurious detections and unnecessary computation.
  • Increase inLineBlindness to reject weak secondary lines; decrease it to include fainter candidates.

Examples

FindMultipleLines locating two intersecting lines. The dashed rectangle is the scan field, the blue and yellow dots are candidates selected for two lines, and the green lines are detected lines.

Remarks

Read more about Local Coordinate Systems in Machine Vision Guide: Local Coordinate Systems.

Hardware Acceleration

This operation supports automatic parallelization for multicore and multiprocessor systems.

See Also

  • FindSingleLine – Finds a single straight line within a rectangular scan field.