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
6bd5e12b
Commit
6bd5e12b
authored
Jul 13, 2013
by
Daniel Angelov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a sample to show usage of the class.
parent
e51e00ac
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
6 deletions
+58
-6
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+1
-1
lsd.cpp
modules/imgproc/src/lsd.cpp
+7
-5
lsd_lines.cpp
samples/cpp/lsd_lines.cpp
+50
-0
No files found.
modules/imgproc/include/opencv2/imgproc.hpp
View file @
6bd5e12b
...
...
@@ -899,7 +899,7 @@ public:
* @param lines2 The second lines that need to be drawn. Color - Red.
* @return The number of mismatching pixels between lines1 and lines2.
*/
static
int
compareSegments
(
cv
::
Size
&
size
,
const
std
::
vector
<
cv
::
Vec4i
>&
lines1
,
const
std
::
vector
<
cv
::
Vec4i
>
lines2
,
cv
::
Mat
*
image
=
0
);
static
int
compareSegments
(
c
onst
c
v
::
Size
&
size
,
const
std
::
vector
<
cv
::
Vec4i
>&
lines1
,
const
std
::
vector
<
cv
::
Vec4i
>
lines2
,
cv
::
Mat
*
image
=
0
);
private
:
cv
::
Mat
image
;
...
...
modules/imgproc/src/lsd.cpp
View file @
6bd5e12b
...
...
@@ -957,13 +957,15 @@ void LSD::drawSegments(cv::Mat& image, const std::vector<cv::Vec4i>& lines)
}
}
int
LSD
::
compareSegments
(
cv
::
Size
&
size
,
const
std
::
vector
<
cv
::
Vec4i
>&
lines1
,
const
std
::
vector
<
cv
::
Vec4i
>
lines2
,
cv
::
Mat
*
image
)
int
LSD
::
compareSegments
(
const
cv
::
Size
&
size
,
const
std
::
vector
<
cv
::
Vec4i
>&
lines1
,
const
std
::
vector
<
cv
::
Vec4i
>
lines2
,
cv
::
Mat
*
image
)
{
if
(
image
&&
image
->
size
()
!=
size
)
size
=
image
->
size
();
CV_Assert
(
size
.
area
());
Size
sz
=
size
;
if
(
image
&&
image
->
size
()
!=
size
)
sz
=
image
->
size
();
CV_Assert
(
sz
.
area
());
Mat_
<
uchar
>
I1
=
Mat_
<
uchar
>::
zeros
(
s
ize
);
Mat_
<
uchar
>
I2
=
Mat_
<
uchar
>::
zeros
(
s
ize
);
Mat_
<
uchar
>
I1
=
Mat_
<
uchar
>::
zeros
(
s
z
);
Mat_
<
uchar
>
I2
=
Mat_
<
uchar
>::
zeros
(
s
z
);
// Draw segments
for
(
unsigned
int
i
=
0
;
i
<
lines1
.
size
();
++
i
)
...
...
samples/cpp/lsd_lines.cpp
0 → 100644
View file @
6bd5e12b
#include <iostream>
#include <string>
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
using
namespace
std
;
using
namespace
cv
;
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
!=
2
)
{
std
::
cout
<<
"lsd_lines [input image]"
<<
std
::
endl
;
return
false
;
}
std
::
string
in
=
argv
[
1
];
Mat
image
=
imread
(
in
,
CV_LOAD_IMAGE_GRAYSCALE
);
// Create and LSD detector with std refinement.
LSD
lsd_std
(
LSD_REFINE_STD
);
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.
LSD
lsd_none
(
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
;
Mat
difference
=
Mat
::
zeros
(
image
.
size
(),
CV_8UC1
);
LSD
::
compareSegments
(
image
.
size
(),
lines_std
,
lines_none
,
&
difference
);
imshow
(
"Line difference"
,
difference
);
Mat
drawnLines
(
image
);
LSD
::
drawSegments
(
drawnLines
,
lines_std
);
imshow
(
"Standard refinement"
,
drawnLines
);
waitKey
();
return
0
;
}
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