Table of Contents

Class FastLineDetector

Namespace
OpenCvSharp.XImgProc
Assembly
OpenCvSharp.dll

Class implementing the FLD (Fast Line Detector) algorithm described in @cite Lee14.

public class FastLineDetector : Algorithm, IDisposable, ICvPtrHolder
Inheritance
FastLineDetector
Implements
Inherited Members

Constructors

FastLineDetector(nint)

Creates instance by raw pointer

protected FastLineDetector(nint p)

Parameters

p nint

Methods

Create(int, float, double, double, int, bool)

Creates a smart pointer to a FastLineDetector object and initializes it

public static FastLineDetector Create(int lengthThreshold = 10, float distanceThreshold = 1.4142135, double cannyTh1 = 50, double cannyTh2 = 50, int cannyApertureSize = 3, bool doMerge = false)

Parameters

lengthThreshold int

Segment shorter than this will be discarded

distanceThreshold float

A point placed from a hypothesis line segment farther than this will be regarded as an outlier

cannyTh1 double

First threshold for hysteresis procedure in Canny()

cannyTh2 double

Second threshold for hysteresis procedure in Canny()

cannyApertureSize int

Aperturesize for the sobel operator in Canny()

doMerge bool

If true, incremental merging of segments will be perfomred

Returns

FastLineDetector

Detect(InputArray)

Finds lines in the input image. This is the output of the default parameters of the algorithm on the above shown image.

public virtual Vec4f[] Detect(InputArray image)

Parameters

image InputArray

A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: fld_ptr-\>detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);

Returns

Vec4f[]

A vector of Vec4f elements specifying the beginning and ending point of a line. Where Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end.Returned lines are directed so that the brighter side is on their left.

Detect(InputArray, OutputArray)

Finds lines in the input image. This is the output of the default parameters of the algorithm on the above shown image.

public virtual void Detect(InputArray image, OutputArray lines)

Parameters

image InputArray

A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: fld_ptr-\>detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);

lines OutputArray

A vector of Vec4f elements specifying the beginning and ending point of a line. Where Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end.Returned lines are directed so that the brighter side is on their left.

DisposeManaged()

Releases managed resources

protected override void DisposeManaged()

DrawSegments(InputOutputArray, InputArray, bool)

Draws the line segments on a given image.

public virtual void DrawSegments(InputOutputArray image, InputArray lines, bool drawArrow = false)

Parameters

image InputOutputArray

The image, where the lines will be drawn. Should be bigger or equal to the image, where the lines were found.

lines InputArray

A vector of the lines that needed to be drawn.

drawArrow bool

If true, arrow heads will be drawn.

DrawSegments(InputOutputArray, IEnumerable<Vec4f>, bool)

Draws the line segments on a given image.

public virtual void DrawSegments(InputOutputArray image, IEnumerable<Vec4f> lines, bool drawArrow = false)

Parameters

image InputOutputArray

The image, where the lines will be drawn. Should be bigger or equal to the image, where the lines were found.

lines IEnumerable<Vec4f>

A vector of the lines that needed to be drawn.

drawArrow bool

If true, arrow heads will be drawn.