|
|
|
@ -27,10 +27,6 @@ int main(int argc, char** argv) |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Create LSD detector
|
|
|
|
|
Ptr<LineSegmentDetector> lsd = createLineSegmentDetector(); |
|
|
|
|
vector<Vec4f> lines_lsd; |
|
|
|
|
|
|
|
|
|
// Create FLD detector
|
|
|
|
|
// Param Default value Description
|
|
|
|
|
// length_threshold 10 - Segments shorter than this will be discarded
|
|
|
|
@ -57,29 +53,18 @@ int main(int argc, char** argv) |
|
|
|
|
vector<Vec4f> lines_fld; |
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
// times to see each algorithm's processing time with sufficiently warmed-up
|
|
|
|
|
// an algorithm takes much longer. So here we run the algorithm 10 times
|
|
|
|
|
// to see the algorithm's processing time with sufficiently warmed-up
|
|
|
|
|
// CPU performance.
|
|
|
|
|
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 duration_ms_lsd = double(getTickCount() - start_lsd) * 1000 / freq; |
|
|
|
|
std::cout << "Elapsed time for LSD: " << duration_ms_lsd << " ms." << std::endl; |
|
|
|
|
|
|
|
|
|
lines_fld.clear(); |
|
|
|
|
int64 start = getTickCount(); |
|
|
|
|
// Detect the lines with FLD
|
|
|
|
|
fld->detect(image, lines_fld); |
|
|
|
|
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
|
|
|
|
|
Mat line_image_fld(image); |
|
|
|
|