Back to Aurora Vision Library website

You are here: Start » Function Reference » Geometry 2D » Geometry 2D Fitting » FitLineToPoints_TheilSen

FitLineToPoints_TheilSen


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Approximates points with a line using TheilSen algorithm, optionally with Siegel's improvement.

Applications: Finds a well matching line, ignoring up to 29.3% (TheilSen) or 50.0% (Siegel) outliers. Outliers do have some influence on accuracy.

Syntax

C++
C#
 
void avl::FitLineToPoints_TheilSen
(
	const atl::Array<avl::Point2D>& inPoints,
	atl::Optional<const avl::Range&> inRange,
	avl::TheilSenVariant::Type inVariant,
	atl::Optional<int> inSampleLimit,
	atl::Optional<float> inOutlierRatio,
	avl::Line2D& outLine,
	atl::Array<float>& diagOrientations
)

Parameters

Name Type Range Default Description
Input value inPoints const Array<Point2D>& Input points
Input value inRange Optional<const Range&> NIL Determines which array points take part in fitting process
Input value inVariant TheilSenVariant::Type Switches between Theil-Sen and Siegel methods
Input value inSampleLimit Optional<int> 5 - NIL How many pairs of points are used to estimate orientation
Input value inOutlierRatio Optional<float> 0.0 - 0.99 NIL
Output value outLine Line2D& Fitted line
Diagnostic input diagOrientations Array<float>& Sample orientations used to determine the output line orientation

Errors

List of possible exceptions:

Error type Description
DomainError Empty array of points in FitLineToPoints_TheilSen.
DomainError Range exceeds the input point array in FitLineToPoints_TheilSen.