Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
06c138bd
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,发现更多精彩内容 >>
提交
06c138bd
编写于
3月 07, 2014
作者:
V
Vadim Pisarevsky
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make the correctness test pass
上级
8e1918e8
变更
2
展开全部
显示空白变更内容
内联
并排
Showing
2 changed file
with
136 addition
and
1190 deletion
+136
-1190
modules/features2d/src/fast.cpp
modules/features2d/src/fast.cpp
+27
-12
modules/features2d/src/opencl/fast.cl
modules/features2d/src/opencl/fast.cl
+109
-1178
未找到文件。
modules/features2d/src/fast.cpp
浏览文件 @
06c138bd
...
@@ -250,6 +250,11 @@ void FAST_t(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bo
...
@@ -250,6 +250,11 @@ void FAST_t(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bo
}
}
}
}
template
<
typename
pt
>
struct
cmp_pt
{
bool
operator
()(
const
pt
&
a
,
const
pt
&
b
)
const
{
return
a
.
y
<
b
.
y
||
(
a
.
y
==
b
.
y
&&
a
.
x
<
b
.
x
);
}
};
static
bool
ocl_FAST
(
InputArray
_img
,
std
::
vector
<
KeyPoint
>&
keypoints
,
static
bool
ocl_FAST
(
InputArray
_img
,
std
::
vector
<
KeyPoint
>&
keypoints
,
int
threshold
,
bool
nonmax_suppression
,
int
maxKeypoints
)
int
threshold
,
bool
nonmax_suppression
,
int
maxKeypoints
)
...
@@ -265,8 +270,8 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
...
@@ -265,8 +270,8 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
UMat
kp1
(
1
,
maxKeypoints
*
2
+
1
,
CV_32S
),
score
;
UMat
kp1
(
1
,
maxKeypoints
*
2
+
1
,
CV_32S
),
score
;
UMat
u
temp
(
kp1
,
Rect
(
0
,
0
,
1
,
1
));
UMat
u
counter1
(
kp1
,
Rect
(
0
,
0
,
1
,
1
));
u
temp
.
setTo
(
Scalar
::
all
(
0
));
u
counter1
.
setTo
(
Scalar
::
all
(
0
));
if
(
nonmax_suppression
)
if
(
nonmax_suppression
)
{
{
...
@@ -284,10 +289,15 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
...
@@ -284,10 +289,15 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
return
false
;
return
false
;
Mat
mcounter
;
Mat
mcounter
;
u
temp
.
copyTo
(
mcounter
);
u
counter1
.
copyTo
(
mcounter
);
int
i
,
counter
=
mcounter
.
at
<
int
>
(
0
);
int
i
,
counter
=
mcounter
.
at
<
int
>
(
0
);
counter
=
std
::
min
(
counter
,
maxKeypoints
);
keypoints
.
clear
();
keypoints
.
clear
();
if
(
counter
==
0
)
return
true
;
if
(
!
nonmax_suppression
)
if
(
!
nonmax_suppression
)
{
{
Mat
m
;
Mat
m
;
...
@@ -299,24 +309,29 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
...
@@ -299,24 +309,29 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
else
else
{
{
UMat
kp2
(
1
,
maxKeypoints
*
3
+
1
,
CV_32S
);
UMat
kp2
(
1
,
maxKeypoints
*
3
+
1
,
CV_32S
);
utemp
=
kp2
(
Rect
(
0
,
0
,
1
,
1
));
UMat
ucounter2
=
kp2
(
Rect
(
0
,
0
,
1
,
1
));
u
temp
.
setTo
(
Scalar
::
all
(
0
));
u
counter2
.
setTo
(
Scalar
::
all
(
0
));
ocl
::
Kernel
fastNMSKernel
(
"FAST_nonmaxSupression"
,
ocl
::
features2d
::
fast_oclsrc
);
ocl
::
Kernel
fastNMSKernel
(
"FAST_nonmaxSupression"
,
ocl
::
features2d
::
fast_oclsrc
);
if
(
fastNMSKernel
.
empty
())
if
(
fastNMSKernel
.
empty
())
return
false
;
return
false
;
size_t
globalsize_nms
[]
=
{
counter
};
if
(
!
fastNMSKernel
.
args
(
ocl
::
KernelArg
::
PtrReadOnly
(
kp1
),
if
(
!
fastNMSKernel
.
args
(
ocl
::
KernelArg
::
PtrReadOnly
(
kp1
),
ocl
::
KernelArg
::
PtrReadWrite
(
kp2
),
ocl
::
KernelArg
::
PtrReadWrite
(
kp2
),
ocl
::
KernelArg
::
ReadOnlyNoSize
(
score
),
ocl
::
KernelArg
::
ReadOnlyNoSize
(
score
),
counter
,
maxKeypoints
).
run
(
2
,
globalsize
,
0
,
true
))
counter
,
counter
).
run
(
1
,
globalsize_nms
,
0
,
true
))
return
false
;
return
false
;
Mat
m
;
Mat
m2
;
kp2
(
Rect
(
0
,
0
,
counter
*
3
+
1
,
1
)).
copyTo
(
m
);
kp2
(
Rect
(
0
,
0
,
counter
*
3
+
1
,
1
)).
copyTo
(
m2
);
const
Point3i
*
pt
=
(
const
Point3i
*
)(
m
.
ptr
<
int
>
()
+
1
);
Point3i
*
pt2
=
(
Point3i
*
)(
m2
.
ptr
<
int
>
()
+
1
);
for
(
i
=
0
;
i
<
counter
;
i
++
)
int
newcounter
=
std
::
min
(
m2
.
at
<
int
>
(
0
),
counter
);
keypoints
.
push_back
(
KeyPoint
((
float
)
pt
[
i
].
x
,
(
float
)
pt
[
i
].
y
,
7.
f
,
-
1
,
(
float
)
pt
[
i
].
z
));
std
::
sort
(
pt2
,
pt2
+
newcounter
,
cmp_pt
<
Point3i
>
());
for
(
i
=
0
;
i
<
newcounter
;
i
++
)
keypoints
.
push_back
(
KeyPoint
((
float
)
pt2
[
i
].
x
,
(
float
)
pt2
[
i
].
y
,
7.
f
,
-
1
,
(
float
)
pt2
[
i
].
z
));
}
}
return
true
;
return
true
;
...
@@ -325,7 +340,7 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
...
@@ -325,7 +340,7 @@ static bool ocl_FAST( InputArray _img, std::vector<KeyPoint>& keypoints,
void
FAST
(
InputArray
_img
,
std
::
vector
<
KeyPoint
>&
keypoints
,
int
threshold
,
bool
nonmax_suppression
,
int
type
)
void
FAST
(
InputArray
_img
,
std
::
vector
<
KeyPoint
>&
keypoints
,
int
threshold
,
bool
nonmax_suppression
,
int
type
)
{
{
if
(
ocl
::
useOpenCL
()
&&
/*_img.isUMat() &&*/
type
==
FastFeatureDetector
::
TYPE_9_16
&&
if
(
ocl
::
useOpenCL
()
&&
_img
.
isUMat
()
&&
type
==
FastFeatureDetector
::
TYPE_9_16
&&
ocl_FAST
(
_img
,
keypoints
,
threshold
,
nonmax_suppression
,
10000
))
ocl_FAST
(
_img
,
keypoints
,
threshold
,
nonmax_suppression
,
10000
))
return
;
return
;
...
...
modules/features2d/src/opencl/fast.cl
浏览文件 @
06c138bd
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录