Unverified Commit 5e254cff authored by Suleyman TURKMEN's avatar Suleyman TURKMEN Committed by GitHub

Update fld_lines.cpp

parent 7bba4cf0
...@@ -27,10 +27,6 @@ int main(int argc, char** argv) ...@@ -27,10 +27,6 @@ int main(int argc, char** argv)
return -1; return -1;
} }
// Create LSD detector
Ptr<LineSegmentDetector> lsd = createLineSegmentDetector();
vector<Vec4f> lines_lsd;
// Create FLD detector // Create FLD detector
// Param Default value Description // Param Default value Description
// length_threshold 10 - Segments shorter than this will be discarded // length_threshold 10 - Segments shorter than this will be discarded
...@@ -57,29 +53,18 @@ int main(int argc, char** argv) ...@@ -57,29 +53,18 @@ int main(int argc, char** argv)
vector<Vec4f> lines_fld; vector<Vec4f> lines_fld;
// Because of some CPU's power strategy, it seems that the first running of // Because of some CPU's power strategy, it seems that the first running of
// an algorithm takes much longer. So here we run both of the algorithmes 10 // an algorithm takes much longer. So here we run the algorithm 10 times
// times to see each algorithm's processing time with sufficiently warmed-up // to see the algorithm's processing time with sufficiently warmed-up
// CPU performance. // CPU performance.
for(int run_count = 0; run_count < 10; run_count++) { for(int run_count = 0; run_count < 10; run_count++) {
lines_lsd.clear();
int64 start_lsd = getTickCount();
lsd->detect(image, lines_lsd);
// Detect the lines with LSD
double freq = getTickFrequency(); double freq = getTickFrequency();
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(); lines_fld.clear();
int64 start = getTickCount(); int64 start = getTickCount();
// Detect the lines with FLD // Detect the lines with FLD
fld->detect(image, lines_fld); fld->detect(image, lines_fld);
double duration_ms = double(getTickCount() - start) * 1000 / freq; double duration_ms = double(getTickCount() - start) * 1000 / freq;
std::cout << "Ealpsed time for FLD " << duration_ms << " ms." << std::endl; std::cout << "Elapsed time for FLD " << duration_ms << " ms." << std::endl;
} }
// Show found lines with LSD
Mat line_image_lsd(image);
lsd->drawSegments(line_image_lsd, lines_lsd);
imshow("LSD result", line_image_lsd);
// Show found lines with FLD // Show found lines with FLD
Mat line_image_fld(image); Mat line_image_fld(image);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment