Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
982ccd78
Commit
982ccd78
authored
Jul 22, 2013
by
Daniel Angelov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the update on the sample.
parent
6fa4834f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
lsd_lines.cpp
samples/cpp/lsd_lines.cpp
+23
-20
No files found.
samples/cpp/lsd_lines.cpp
View file @
982ccd78
...
...
@@ -11,37 +11,40 @@ using namespace cv;
int
main
(
int
argc
,
char
**
argv
)
{
std
::
string
in
;
if
(
argc
!=
2
)
{
std
::
cout
<<
"lsd_lines [input image]"
<<
std
::
endl
;
return
false
;
std
::
cout
<<
"Usage: lsd_lines [input image]. Now loading building.jpg"
<<
std
::
endl
;
in
=
"building.jpg"
;
}
else
{
in
=
argv
[
1
];
}
std
::
string
in
=
argv
[
1
];
Mat
image
=
imread
(
in
,
IMREAD_GRAYSCALE
);
// Create and LSD detector with std refinement.
LineSegmentDetector
*
lsd_std
=
createLineSegmentDetectorPtr
(
LSD_REFINE_STD
);
#if 0
Canny(image, image, 50, 200, 3); // Apply canny edge
#endif
// Create and LSD detector with standard or no refinement.
#if 1
Ptr
<
LineSegmentDetector
>
ls
=
createLineSegmentDetectorPtr
(
LSD_REFINE_STD
);
#else
Ptr
<
LineSegmentDetector
>
ls
=
createLineSegmentDetectorPtr
(
LSD_REFINE_NONE
);
#endif
double
start
=
double
(
getTickCount
());
vector
<
Vec4i
>
lines_std
;
lsd_std
->
detect
(
image
,
lines_std
);
double
duration_ms
=
(
double
(
getTickCount
())
-
start
)
*
1000
/
getTickFrequency
();
std
::
cout
<<
"OpenCV STD (blue) - "
<<
duration_ms
<<
" ms."
<<
std
::
endl
;
// Create an LSD detector with no refinement applied.
LineSegmentDetector
*
lsd_none
=
createLineSegmentDetectorPtr
(
LSD_REFINE_NONE
);
start
=
double
(
getTickCount
());
vector
<
Vec4i
>
lines_none
;
lsd_none
->
detect
(
image
,
lines_none
);
duration_ms
=
(
double
(
getTickCount
())
-
start
)
*
1000
/
getTickFrequency
();
std
::
cout
<<
"OpenCV NONE (red)- "
<<
duration_ms
<<
" ms."
<<
std
::
endl
;
std
::
cout
<<
"Overlapping pixels are shown in purple."
<<
std
::
endl
;
// Detect the lines
ls
->
detect
(
image
,
lines_std
);
Mat
difference
=
Mat
::
zeros
(
image
.
size
(),
CV_8UC1
);
lsd_none
->
compareSegments
(
image
.
size
(),
lines_std
,
lines_none
,
&
difference
);
imshow
(
"Line difference"
,
difference
);
double
duration_ms
=
(
double
(
getTickCount
())
-
start
)
*
1000
/
getTickFrequency
();
std
::
cout
<<
"It took "
<<
duration_ms
<<
" ms."
<<
std
::
endl
;
// Show found lines
Mat
drawnLines
(
image
);
lsd_none
->
drawSegments
(
drawnLines
,
lines_std
);
imshow
(
"Standard refinement"
,
drawnLines
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment