Table of Contents

Method FitLine

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

FitLine(InputArray, OutputArray, DistanceTypes, double, double, double)

Fits line to the set of 2D points using M-estimator algorithm

public static void FitLine(InputArray points, OutputArray line, DistanceTypes distType, double param, double reps, double aeps)

Parameters

points InputArray

Input vector of 2D or 3D points

line OutputArray

Output line parameters. In case of 2D fitting, it should be a vector of 4 elements (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and (x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line and (x0, y0, z0) is a point on the line.

distType DistanceTypes

Distance used by the M-estimator

param double

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

reps double

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

aeps double

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

FitLine(IEnumerable<Point>, DistanceTypes, double, double, double)

Fits line to the set of 2D points using M-estimator algorithm

public static Line2D FitLine(IEnumerable<Point> points, DistanceTypes distType, double param, double reps, double aeps)

Parameters

points IEnumerable<Point>

Input vector of 2D or 3D points

distType DistanceTypes

Distance used by the M-estimator

param double

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

reps double

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

aeps double

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

Returns

Line2D

Output line parameters.

FitLine(IEnumerable<Point2f>, DistanceTypes, double, double, double)

Fits line to the set of 2D points using M-estimator algorithm

public static Line2D FitLine(IEnumerable<Point2f> points, DistanceTypes distType, double param, double reps, double aeps)

Parameters

points IEnumerable<Point2f>

Input vector of 2D or 3D points

distType DistanceTypes

Distance used by the M-estimator

param double

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

reps double

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

aeps double

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

Returns

Line2D

Output line parameters.

FitLine(IEnumerable<Point3i>, DistanceTypes, double, double, double)

Fits line to the set of 3D points using M-estimator algorithm

public static Line3D FitLine(IEnumerable<Point3i> points, DistanceTypes distType, double param, double reps, double aeps)

Parameters

points IEnumerable<Point3i>

Input vector of 2D or 3D points

distType DistanceTypes

Distance used by the M-estimator

param double

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

reps double

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

aeps double

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

Returns

Line3D

Output line parameters.

FitLine(IEnumerable<Point3f>, DistanceTypes, double, double, double)

Fits line to the set of 3D points using M-estimator algorithm

public static Line3D FitLine(IEnumerable<Point3f> points, DistanceTypes distType, double param, double reps, double aeps)

Parameters

points IEnumerable<Point3f>

Input vector of 2D or 3D points

distType DistanceTypes

Distance used by the M-estimator

param double

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

reps double

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

aeps double

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

Returns

Line3D

Output line parameters.