opencv on mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

LineSegmentDetector Class Reference

Line segment detector class. More...

#include <imgproc.hpp>

Inherits cv::Algorithm.

Public Member Functions

virtual CV_WRAP void detect (InputArray _image, OutputArray _lines, OutputArray width=noArray(), OutputArray prec=noArray(), OutputArray nfa=noArray())=0
 Finds lines in the input image.
virtual CV_WRAP void drawSegments (InputOutputArray _image, InputArray lines)=0
 Draws the line segments on a given image.
virtual CV_WRAP int compareSegments (const Size &size, InputArray lines1, InputArray lines2, InputOutputArray _image=noArray())=0
 Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels.
virtual CV_WRAP void clear ()
 Clears the algorithm state.
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage.
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage.
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g.
virtual CV_WRAP void save (const String &filename) const
 Saves the algorithm to a file.
virtual CV_WRAP String getDefaultName () const
 Returns the algorithm string identifier.

Static Public Member Functions

template<typename _Tp >
static Ptr< _Tp > read (const FileNode &fn)
 Reads algorithm from the file node.
template<typename _Tp >
static Ptr< _Tp > load (const String &filename, const String &objname=String())
 Loads algorithm from the file.
template<typename _Tp >
static Ptr< _Tp > loadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String.

Detailed Description

Line segment detector class.

following the algorithm described at Rafael12 .

Definition at line 978 of file imgproc.hpp.


Member Function Documentation

virtual CV_WRAP void clear (  ) [virtual, inherited]

Clears the algorithm state.

Reimplemented in DescriptorMatcher, and FlannBasedMatcher.

Definition at line 2984 of file core.hpp.

virtual CV_WRAP int compareSegments ( const Size size,
InputArray  lines1,
InputArray  lines2,
InputOutputArray  _image = noArray() 
) [pure virtual]

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

Parameters:
sizeThe size of the image, where lines1 and lines2 were found.
lines1The first group of lines that needs to be drawn. It is visualized in blue color.
lines2The second group of lines. They visualized in red color.
_imageOptional 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.
virtual CV_WRAP void detect ( InputArray  _image,
OutputArray  _lines,
OutputArray  width = noArray(),
OutputArray  prec = noArray(),
OutputArray  nfa = noArray() 
) [pure virtual]

Finds lines in the input image.

This is the output of the default parameters of the algorithm on the above shown image.

![image](pics/building_lsd.png)

Parameters:
_imageA grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: `lsd_ptr->detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);`
_linesA 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.
widthVector of widths of the regions, where the lines are found. E.g. Width of line.
precVector of precisions with which the lines are found.
nfaVector containing number of false alarms in the line region, with precision of 10%. The bigger the value, logarithmically better the detection.

  • -1 corresponds to 10 mean false alarms
  • 0 corresponds to 1 mean false alarm
  • 1 corresponds to 0.1 mean false alarms This vector will be calculated only when the objects type is LSD_REFINE_ADV.
virtual CV_WRAP void drawSegments ( InputOutputArray  _image,
InputArray  lines 
) [pure virtual]

Draws the line segments on a given image.

Parameters:
_imageThe image, where the liens will be drawn. Should be bigger or equal to the image, where the lines were found.
linesA vector of the lines that needed to be drawn.
virtual bool empty (  ) const [virtual, inherited]

Returns true if the Algorithm is empty (e.g.

in the very beginning or after unsuccessful read

Reimplemented in Feature2D, DescriptorMatcher, and StatModel.

Definition at line 2996 of file core.hpp.

virtual CV_WRAP String getDefaultName (  ) const [virtual, inherited]

Returns the algorithm string identifier.

This string is used as top level xml/yml node tag when the object is saved to a file or string.

static Ptr<_Tp> load ( const String &  filename,
const String &  objname = String() 
) [static, inherited]

Loads algorithm from the file.

Parameters:
filenameName of the file to read.
objnameThe optional name of the node to read (if empty, the first top-level node will be used)

This is static template method of Algorithm. It's usage is following (in the case of SVM):

     Ptr<SVM> svm = Algorithm::load<SVM>("my_svm_model.xml");

In order to make this method work, the derived class must overwrite Algorithm::read(const FileNode& fn).

Definition at line 3027 of file core.hpp.

static Ptr<_Tp> loadFromString ( const String &  strModel,
const String &  objname = String() 
) [static, inherited]

Loads algorithm from a String.

Parameters:
strModelThe string variable containing the model you want to load.
objnameThe optional name of the node to read (if empty, the first top-level node will be used)

This is static template method of Algorithm. It's usage is following (in the case of SVM):

     Ptr<SVM> svm = Algorithm::loadFromString<SVM>(myStringModel);

Definition at line 3046 of file core.hpp.

virtual void read ( const FileNode fn ) [virtual, inherited]

Reads algorithm parameters from a file storage.

Reimplemented in DescriptorMatcher, and FlannBasedMatcher.

Definition at line 2992 of file core.hpp.

static Ptr<_Tp> read ( const FileNode fn ) [static, inherited]

Reads algorithm from the file node.

This is static template method of Algorithm. It's usage is following (in the case of SVM):

     Ptr<SVM> svm = Algorithm::read<SVM>(fn);

In order to make this method work, the derived class must overwrite Algorithm::read(const FileNode& fn) and also have static create() method without parameters (or with all the optional parameters)

Reimplemented in DescriptorMatcher, and FlannBasedMatcher.

Definition at line 3008 of file core.hpp.

virtual CV_WRAP void save ( const String &  filename ) const [virtual, inherited]

Saves the algorithm to a file.

In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).

virtual void write ( FileStorage fs ) const [virtual, inherited]

Stores algorithm parameters in a file storage.

Reimplemented in DescriptorMatcher, and FlannBasedMatcher.

Definition at line 2988 of file core.hpp.