Back to FabImage Library website
You are here: Start » Function Reference » Geometry 2D » Geometry 2D Fitting » FitSegmentToPoints_TheilSen
FitSegmentToPoints_TheilSen
| Header: | FIL.h |
|---|---|
| Namespace: | fil |
| Module: | FoundationBasic |
Approximates points with a segment using TheilSen algorithm, optionally with Siegel's improvement.
Applications: Finds a well matching segment, ignoring up to 29.3% (TheilSen) or 50.0% (Siegel) outliers. Outliers do have some influence on accuracy.
Syntax
C++
C#
void fil::FitSegmentToPoints_TheilSen ( const ftl::Array<fil::Point2D>& inPoints, ftl::Optional<const fil::Range&> inRange, fil::TheilSenVariant::Type inVariant, ftl::Optional<int> inSampleLimit, ftl::Optional<float> inOutlierRatio, fil::Segment2D& outSegment, ftl::Array<float>& diagOrientations )
Parameters
| Name | Type | Range | Default | Description | |
|---|---|---|---|---|---|
![]() |
inPoints | const Array<Point2D>& | Input points | ||
![]() |
inRange | Optional<const Range&> | NIL | Determines which array points take part in fitting process | |
![]() |
inVariant | TheilSenVariant::Type | Switches between Theil-Sen and Siegel methods | ||
![]() |
inSampleLimit | Optional<int> | 5 - ![]() |
NIL | How many pairs of points are used to estimate orientation |
![]() |
inOutlierRatio | Optional<float> | 0.0 - 0.99 | NIL | |
![]() |
outSegment | Segment2D& | Fitted segment | ||
![]() |
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 FitSegmentToPoints_TheilSen. |
| DomainError | Range exceeds the input point array in FitSegmentToPoints_TheilSen. |




