An example using the FastLineDetector
#include <iostream>
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}");
{
return 0;
}
in = parser.
get<
string>(
"@input");
if( image.empty() )
{
return -1;
}
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_fld.clear();
fld->
detect(image, lines_fld);
double duration_ms = double(
getTickCount() - start) * 1000 / freq;
std::cout << "Elapsed time for FLD " << duration_ms << " ms." << std::endl;
}
Mat line_image_fld(image);
imshow(
"FLD result", line_image_fld);
return 0;
}