Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
982ccd78
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
982ccd78
编写于
7月 22, 2013
作者:
D
Daniel Angelov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added the update on the sample.
上级
6fa4834f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
20 deletion
+23
-20
samples/cpp/lsd_lines.cpp
samples/cpp/lsd_lines.cpp
+23
-20
未找到文件。
samples/cpp/lsd_lines.cpp
浏览文件 @
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
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录