Show / Hide Table of Contents

Class LineSegmentDetector

Line segment detector class

Inheritance
System.Object
DisposableObject
DisposableCvObject
Algorithm
LineSegmentDetector
Implements
ICvPtrHolder
Inherited Members
Algorithm.Write(FileStorage)
Algorithm.Read(FileNode)
Algorithm.Empty
Algorithm.Save(String)
Algorithm.GetDefaultName()
DisposableCvObject.ptr
DisposableCvObject.CvPtr
DisposableObject.DataHandle
DisposableObject.IsDisposed
DisposableObject.IsEnabledDispose
DisposableObject.AllocatedMemory
DisposableObject.AllocatedMemorySize
DisposableObject.Dispose()
DisposableObject.Dispose(Boolean)
DisposableObject.AllocGCHandle(Object)
DisposableObject.AllocMemory(Int32)
DisposableObject.NotifyMemoryPressure(Int64)
DisposableObject.ThrowIfDisposed()
Namespace: OpenCvSharp
Assembly: OpenCvSharp.dll
Syntax
public class LineSegmentDetector : Algorithm, ICvPtrHolder

Constructors

| Improve this Doc View Source

LineSegmentDetector(IntPtr)

Declaration
protected LineSegmentDetector(IntPtr p)
Parameters
Type Name Description
IntPtr p

Methods

| Improve this Doc View Source

CompareSegments(Size, InputArray, InputArray, InputOutputArray)

Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels.

Declaration
public virtual int CompareSegments(Size size, InputArray lines1, InputArray lines2, InputOutputArray image = null)
Parameters
Type Name Description
OpenCvSharp.Size size

The size of the image, where lines1 and lines2 were found.

InputArray lines1

The first group of lines that needs to be drawn. It is visualized in blue color.

InputArray lines2

The second group of lines. They visualized in red color.

InputOutputArray image

Optional image, where the lines will be drawn. The image should be color(3-channel) in order for lines1 and lines2 to be drawn in the above mentioned colors.

Returns
Type Description
System.Int32
| Improve this Doc View Source

Create(LineSegmentDetectorModes, Double, Double, Double, Double, Double, Double, Int32)

Creates a smart pointer to a LineSegmentDetector object and initializes it.

Declaration
public static LineSegmentDetector Create(LineSegmentDetectorModes refine = LineSegmentDetectorModes.RefineNone, double scale = 0.8, double sigmaScale = 0.6, double quant = 2, double angTh = 22.5, double logEps = 0, double densityTh = 0.7, int nBins = 1024)
Parameters
Type Name Description
LineSegmentDetectorModes refine

The way found lines will be refined, see cv::LineSegmentDetectorModes

System.Double scale

The scale of the image that will be used to find the lines. Range (0..1].

System.Double sigmaScale

Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale.

System.Double quant

Bound to the quantization error on the gradient norm.

System.Double angTh

Gradient angle tolerance in degrees.

System.Double logEps

Detection threshold: -log10(NFA) > log_eps. Used only when advancent refinement is chosen.

System.Double densityTh

Minimal density of aligned region points in the enclosing rectangle.

System.Int32 nBins

Number of bins in pseudo-ordering of gradient modulus.

Returns
Type Description
LineSegmentDetector
| Improve this Doc View Source

Detect(InputArray, OutputArray, OutputArray, OutputArray, OutputArray)

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

Declaration
public virtual void Detect(InputArray image, OutputArray lines, OutputArray width = null, OutputArray prec = null, OutputArray nfa = null)
Parameters
Type Name Description
InputArray image

A grayscale (CV_8UC1) input image.

OutputArray lines

A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. Where Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly oriented depending on the gradient.

OutputArray width

Vector of widths of the regions, where the lines are found. E.g. Width of line.

OutputArray prec

Vector of precisions with which the lines are found.

OutputArray nfa

Vector containing number of false alarms in the line region, with precision of 10%. The bigger the value, logarithmically better the detection.

| Improve this Doc View Source

Detect(InputArray, out Vec4f[], out Double[], out Double[], out Double[])

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

Declaration
public virtual void Detect(InputArray image, out Vec4f[] lines, out double[] width, out double[] prec, out double[] nfa)
Parameters
Type Name Description
InputArray image

A grayscale (CV_8UC1) input image.

Vec4f[] lines

A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. Where Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly oriented depending on the gradient.

System.Double[] width

Vector of widths of the regions, where the lines are found. E.g. Width of line.

System.Double[] prec

Vector of precisions with which the lines are found.

System.Double[] nfa

Vector containing number of false alarms in the line region, with precision of 10%. The bigger the value, logarithmically better the detection.

| Improve this Doc View Source

DisposeManaged()

Releases managed resources

Declaration
protected override void DisposeManaged()
Overrides
DisposableObject.DisposeManaged()
| Improve this Doc View Source

DisposeUnmanaged()

Declaration
protected override void DisposeUnmanaged()
Overrides
DisposableCvObject.DisposeUnmanaged()
| Improve this Doc View Source

DrawSegments(InputOutputArray, InputArray)

Draws the line segments on a given image.

Declaration
public virtual void DrawSegments(InputOutputArray image, InputArray lines)
Parameters
Type Name Description
InputOutputArray image

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

InputArray lines

A vector of the lines that needed to be drawn.

| Improve this Doc View Source

Get()

Declaration
public override IntPtr Get()
Returns
Type Description
IntPtr

Implements

ICvPtrHolder
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX