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
pnint
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
lengthThresholdintSegment shorter than this will be discarded
distanceThresholdfloatA point placed from a hypothesis line segment farther than this will be regarded as an outlier
cannyTh1doubleFirst threshold for hysteresis procedure in Canny()
cannyTh2doubleSecond threshold for hysteresis procedure in Canny()
cannyApertureSizeintAperturesize for the sobel operator in Canny()
doMergeboolIf true, incremental merging of segments will be perfomred
Returns
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
imageInputArrayA 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
imageInputArrayA 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);linesOutputArrayA 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
imageInputOutputArrayThe image, where the lines will be drawn. Should be bigger or equal to the image, where the lines were found.
linesInputArrayA vector of the lines that needed to be drawn.
drawArrowboolIf 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
imageInputOutputArrayThe image, where the lines will be drawn. Should be bigger or equal to the image, where the lines were found.
linesIEnumerable<Vec4f>A vector of the lines that needed to be drawn.
drawArrowboolIf true, arrow heads will be drawn.