|
virtual | ~FastLineDetector () |
|
virtual void | detect (InputArray _image, OutputArray _lines)=0 |
| Finds lines in the input image. This is the output of the default parameters of the algorithm on the above shown image.
|
|
virtual void | drawSegments (InputOutputArray _image, InputArray lines, bool draw_arrow=false)=0 |
| Draws the line segments on a given image.
|
|
| Algorithm () |
|
virtual | ~Algorithm () |
|
virtual void | clear () |
| Clears the algorithm state.
|
|
virtual bool | empty () const |
| Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
|
|
virtual String | getDefaultName () const |
|
virtual void | read (const FileNode &fn) |
| Reads algorithm parameters from a file storage.
|
|
virtual void | save (const String &filename) const |
|
virtual void | write (FileStorage &fs) const |
| Stores algorithm parameters in a file storage.
|
|
void | write (const Ptr< FileStorage > &fs, const String &name=String()) const |
| simplified API for language bindingsThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
Class implementing the FLD (Fast Line Detector) algorithm described in.
Lee14 .
#include <iostream>
using namespace std;
using namespace cv;
using namespace cv::ximgproc;
int main(int argc, char** argv)
{
std::string in;
cv::CommandLineParser parser(argc, argv,
"{@input|../samples/data/corridor.jpg|input image}{help h||show help message}");
if (parser.has("help"))
{
parser.printMessage();
return 0;
}
in = parser.get<string>("@input");
if( image.empty() )
{
return -1;
}
vector<Vec4f> lines_lsd;
int length_threshold = 10;
float distance_threshold = 1.41421356f;
double canny_th1 = 50.0;
double canny_th2 = 50.0;
int canny_aperture_size = 3;
bool do_merge = false;
distance_threshold, canny_th1, canny_th2, canny_aperture_size,
do_merge);
vector<Vec4f> lines_fld;
for(int run_count = 0; run_count < 10; run_count++) {
lines_lsd.clear();
lsd->detect(image, lines_lsd);
double duration_ms_lsd = double(
getTickCount() - start_lsd) * 1000 / freq;
std::cout << "Elapsed time for LSD: " << duration_ms_lsd << " ms." << std::endl;
lines_fld.clear();
fld->detect(image, lines_fld);
double duration_ms = double(
getTickCount() - start) * 1000 / freq;
std::cout << "Ealpsed time for FLD " << duration_ms << " ms." << std::endl;
}
Mat line_image_lsd(image);
lsd->drawSegments(line_image_lsd, lines_lsd);
imshow(
"LSD result", line_image_lsd);
Mat line_image_fld(image);
fld->drawSegments(line_image_fld, lines_fld);
imshow(
"FLD result", line_image_fld);
return 0;
}