Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
fdbed4a4
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
fdbed4a4
编写于
9月 26, 2015
作者:
B
Balint Cristian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Speedup AGAST nonmax-suppression.
上级
3a3f4038
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
25 addition
and
25 deletion
+25
-25
modules/features2d/src/agast.cpp
modules/features2d/src/agast.cpp
+25
-25
未找到文件。
modules/features2d/src/agast.cpp
浏览文件 @
fdbed4a4
...
...
@@ -7511,19 +7511,22 @@ Ptr<AgastFeatureDetector> AgastFeatureDetector::create( int threshold, bool nonm
void
AGAST
(
InputArray
_img
,
std
::
vector
<
KeyPoint
>&
keypoints
,
int
threshold
,
bool
nonmax_suppression
,
int
type
)
{
std
::
vector
<
KeyPoint
>
kpts
;
// detect
switch
(
type
)
{
case
AgastFeatureDetector
::
AGAST_5_8
:
AGAST_5_8
(
_img
,
k
eypoin
ts
,
threshold
);
AGAST_5_8
(
_img
,
k
p
ts
,
threshold
);
break
;
case
AgastFeatureDetector
::
AGAST_7_12d
:
AGAST_7_12d
(
_img
,
k
eypoin
ts
,
threshold
);
AGAST_7_12d
(
_img
,
k
p
ts
,
threshold
);
break
;
case
AgastFeatureDetector
::
AGAST_7_12s
:
AGAST_7_12s
(
_img
,
k
eypoin
ts
,
threshold
);
AGAST_7_12s
(
_img
,
k
p
ts
,
threshold
);
break
;
case
AgastFeatureDetector
::
OAST_9_16
:
OAST_9_16
(
_img
,
k
eypoin
ts
,
threshold
);
OAST_9_16
(
_img
,
k
p
ts
,
threshold
);
break
;
}
...
...
@@ -7534,7 +7537,7 @@ void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, boo
makeAgastOffsets
(
pixel_
,
(
int
)
img
.
step
,
type
);
std
::
vector
<
KeyPoint
>::
iterator
kpt
;
for
(
kpt
=
k
eypoints
.
begin
();
kpt
!=
keypoin
ts
.
end
();
kpt
++
)
for
(
kpt
=
k
pts
.
begin
();
kpt
!=
kp
ts
.
end
();
kpt
++
)
{
switch
(
type
)
{
case
AgastFeatureDetector
::
AGAST_5_8
:
...
...
@@ -7555,20 +7558,21 @@ void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, boo
break
;
}
}
// suppression
if
(
nonmax_suppression
)
{
size_t
j
;
size_t
curr_idx
;
size_t
lastRow
=
0
,
next_lastRow
=
0
;
size_t
num_Corners
=
k
eypoin
ts
.
size
();
size_t
num_Corners
=
k
p
ts
.
size
();
size_t
lastRowCorner_ind
=
0
,
next_lastRowCorner_ind
=
0
;
std
::
vector
<
int
>
nmsFlags
;
std
::
vector
<
KeyPoint
>::
iterator
currCorner_nms
;
std
::
vector
<
KeyPoint
>::
const_iterator
currCorner
;
currCorner
=
k
eypoin
ts
.
begin
();
currCorner
=
k
p
ts
.
begin
();
nmsFlags
.
resize
((
int
)
num_Corners
);
...
...
@@ -7593,11 +7597,11 @@ void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, boo
if
(
lastRow
+
1
==
currCorner
->
pt
.
y
)
{
// find the corner above the current one
while
(
(
k
eypoin
ts
[
lastRowCorner_ind
].
pt
.
x
<
currCorner
->
pt
.
x
)
&&
(
k
eypoin
ts
[
lastRowCorner_ind
].
pt
.
y
==
lastRow
)
)
while
(
(
k
p
ts
[
lastRowCorner_ind
].
pt
.
x
<
currCorner
->
pt
.
x
)
&&
(
k
p
ts
[
lastRowCorner_ind
].
pt
.
y
==
lastRow
)
)
lastRowCorner_ind
++
;
if
(
(
k
eypoin
ts
[
lastRowCorner_ind
].
pt
.
x
==
currCorner
->
pt
.
x
)
if
(
(
k
p
ts
[
lastRowCorner_ind
].
pt
.
x
==
currCorner
->
pt
.
x
)
&&
(
lastRowCorner_ind
!=
curr_idx
)
)
{
size_t
w
=
lastRowCorner_ind
;
...
...
@@ -7605,7 +7609,7 @@ void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, boo
while
(
nmsFlags
[
w
]
!=
-
1
)
w
=
nmsFlags
[
w
];
if
(
k
eypoints
[
curr_idx
].
response
<
keypoin
ts
[
w
].
response
)
if
(
k
pts
[
curr_idx
].
response
<
kp
ts
[
w
].
response
)
nmsFlags
[
curr_idx
]
=
(
int
)
w
;
else
nmsFlags
[
w
]
=
(
int
)
curr_idx
;
...
...
@@ -7614,8 +7618,8 @@ void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, boo
// check left
t
=
(
int
)
curr_idx
-
1
;
if
(
(
curr_idx
!=
0
)
&&
(
k
eypoin
ts
[
t
].
pt
.
y
==
currCorner
->
pt
.
y
)
&&
(
k
eypoin
ts
[
t
].
pt
.
x
+
1
==
currCorner
->
pt
.
x
)
)
if
(
(
curr_idx
!=
0
)
&&
(
k
p
ts
[
t
].
pt
.
y
==
currCorner
->
pt
.
y
)
&&
(
k
p
ts
[
t
].
pt
.
x
+
1
==
currCorner
->
pt
.
x
)
)
{
int
currCornerMaxAbove_ind
=
nmsFlags
[
curr_idx
];
// find the maximum in that area
...
...
@@ -7626,7 +7630,7 @@ void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, boo
{
if
((
size_t
)
t
!=
curr_idx
)
{
if
(
k
eypoints
[
curr_idx
].
response
<
keypoin
ts
[
t
].
response
)
if
(
k
pts
[
curr_idx
].
response
<
kp
ts
[
t
].
response
)
nmsFlags
[
curr_idx
]
=
t
;
else
nmsFlags
[
t
]
=
(
int
)
curr_idx
;
...
...
@@ -7636,7 +7640,7 @@ void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, boo
{
if
(
t
!=
currCornerMaxAbove_ind
)
{
if
(
k
eypoints
[
currCornerMaxAbove_ind
].
response
<
keypoin
ts
[
t
].
response
)
if
(
k
pts
[
currCornerMaxAbove_ind
].
response
<
kp
ts
[
t
].
response
)
{
nmsFlags
[
currCornerMaxAbove_ind
]
=
t
;
nmsFlags
[
curr_idx
]
=
t
;
...
...
@@ -7652,19 +7656,15 @@ void AGAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, boo
currCorner
++
;
}
//
marks non-
maximum corners
//
collecting
maximum corners
for
(
curr_idx
=
0
;
curr_idx
<
num_Corners
;
curr_idx
++
)
{
if
(
nmsFlags
[
curr_idx
]
!
=
-
1
)
keypoints
[
curr_idx
].
response
=
-
1
;
if
(
nmsFlags
[
curr_idx
]
=
=
-
1
)
keypoints
.
push_back
(
kpts
[
curr_idx
])
;
}
// erase non-maximum corners
for
(
j
=
keypoints
.
size
();
j
>
0
;
j
--
)
}
else
{
if
(
keypoints
[
j
-
1
].
response
==
-
1
)
keypoints
.
erase
(
keypoints
.
begin
()
+
j
-
1
);
}
keypoints
=
kpts
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录