Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
9efd7019
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,发现更多精彩内容 >>
提交
9efd7019
编写于
9月 14, 2012
作者:
Y
yao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
A more reasonable verify method for ocl::HOG accuracy test
上级
1052a0b4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
73 addition
and
12 deletion
+73
-12
modules/ocl/test/test_hog.cpp
modules/ocl/test/test_hog.cpp
+73
-12
未找到文件。
modules/ocl/test/test_hog.cpp
浏览文件 @
9efd7019
...
...
@@ -53,12 +53,10 @@ PARAM_TEST_CASE(HOG,cv::Size,int)
{
cv
::
Size
winSize
;
int
type
;
//vector<cv::ocl::Info> info;
virtual
void
SetUp
()
{
winSize
=
GET_PARAM
(
0
);
type
=
GET_PARAM
(
1
);
//cv::ocl::getDevice(info);
}
};
...
...
@@ -113,6 +111,12 @@ TEST_P(HOG, GetDescriptors)
}
bool
match_rect
(
cv
::
Rect
r1
,
cv
::
Rect
r2
,
int
threshold
)
{
return
((
abs
(
r1
.
x
-
r2
.
x
)
<
threshold
)
&&
(
abs
(
r1
.
y
-
r2
.
y
)
<
threshold
)
&&
(
abs
(
r1
.
width
-
r2
.
width
)
<
threshold
)
&&
(
abs
(
r1
.
height
-
r2
.
height
)
<
threshold
));
}
TEST_P
(
HOG
,
Detect
)
{
// Load image
...
...
@@ -161,32 +165,89 @@ TEST_P(HOG, Detect)
}
// OpenCL detection
std
::
vector
<
cv
::
Point
>
d_v_locations
;
ocl_hog
.
detect
(
d_img
,
d_v_locations
,
0
);
cv
::
Mat
d_locations
(
d_v_locations
);
std
::
vector
<
cv
::
Rect
>
d_found
;
ocl_hog
.
detectMultiScale
(
d_img
,
d_found
,
0
,
cv
::
Size
(
8
,
8
),
cv
::
Size
(
0
,
0
),
1.05
,
2
);
// CPU detection
std
::
vector
<
cv
::
Point
>
v_locations
;
std
::
vector
<
cv
::
Rect
>
found
;
switch
(
type
)
{
case
CV_8UC1
:
hog
.
detect
(
img
,
v_locations
,
0
);
hog
.
detect
MultiScale
(
img
,
found
,
0
,
cv
::
Size
(
8
,
8
),
cv
::
Size
(
0
,
0
),
1.05
,
2
);
break
;
case
CV_8UC4
:
default:
hog
.
detect
(
img_rgb
,
v_locations
,
0
);
hog
.
detect
MultiScale
(
img_rgb
,
found
,
0
,
cv
::
Size
(
8
,
8
),
cv
::
Size
(
0
,
0
),
1.05
,
2
);
break
;
}
cv
::
Mat
locations
(
v_locations
);
// Ground-truth rectangular people window
cv
::
Rect
win1_64x128
(
231
,
190
,
72
,
144
);
cv
::
Rect
win2_64x128
(
621
,
156
,
97
,
194
);
cv
::
Rect
win1_48x96
(
238
,
198
,
63
,
126
);
cv
::
Rect
win2_48x96
(
619
,
161
,
92
,
185
);
cv
::
Rect
win3_48x96
(
488
,
136
,
56
,
112
);
// Compare whether ground-truth windows are detected and compare the number of windows detected.
std
::
vector
<
int
>
d_comp
(
4
);
std
::
vector
<
int
>
comp
(
4
);
for
(
int
i
=
0
;
i
<
(
int
)
d_comp
.
size
();
i
++
)
{
d_comp
[
i
]
=
0
;
comp
[
i
]
=
0
;
}
int
threshold
=
10
;
int
val
=
32
;
d_comp
[
0
]
=
d_found
.
size
();
comp
[
0
]
=
found
.
size
();
if
(
winSize
==
cv
::
Size
(
48
,
96
))
{
for
(
int
i
=
0
;
i
<
(
int
)
d_found
.
size
();
i
++
)
{
if
(
match_rect
(
d_found
[
i
],
win1_48x96
,
threshold
))
d_comp
[
1
]
=
val
;
if
(
match_rect
(
d_found
[
i
],
win2_48x96
,
threshold
))
d_comp
[
2
]
=
val
;
if
(
match_rect
(
d_found
[
i
],
win3_48x96
,
threshold
))
d_comp
[
3
]
=
val
;
}
for
(
int
i
=
0
;
i
<
(
int
)
found
.
size
();
i
++
)
{
if
(
match_rect
(
found
[
i
],
win1_48x96
,
threshold
))
comp
[
1
]
=
val
;
if
(
match_rect
(
found
[
i
],
win2_48x96
,
threshold
))
comp
[
2
]
=
val
;
if
(
match_rect
(
found
[
i
],
win3_48x96
,
threshold
))
comp
[
3
]
=
val
;
}
}
else
if
(
winSize
==
cv
::
Size
(
64
,
128
))
{
for
(
int
i
=
0
;
i
<
(
int
)
d_found
.
size
();
i
++
)
{
if
(
match_rect
(
d_found
[
i
],
win1_64x128
,
threshold
))
d_comp
[
1
]
=
val
;
if
(
match_rect
(
d_found
[
i
],
win2_64x128
,
threshold
))
d_comp
[
2
]
=
val
;
}
for
(
int
i
=
0
;
i
<
(
int
)
found
.
size
();
i
++
)
{
if
(
match_rect
(
found
[
i
],
win1_64x128
,
threshold
))
comp
[
1
]
=
val
;
if
(
match_rect
(
found
[
i
],
win2_64x128
,
threshold
))
comp
[
2
]
=
val
;
}
}
char
s
[
100
]
=
{
0
};
EXPECT_MAT_NEAR
(
d_locations
,
locations
,
0
,
s
);
EXPECT_MAT_NEAR
(
cv
::
Mat
(
d_comp
),
cv
::
Mat
(
comp
),
3
,
s
);
}
INSTANTIATE_TEST_CASE_P
(
OCL_ObjDetect
,
HOG
,
testing
::
Combine
(
INSTANTIATE_TEST_CASE_P
(
GPU_ImgProc
,
HOG
,
testing
::
Combine
(
testing
::
Values
(
cv
::
Size
(
64
,
128
),
cv
::
Size
(
48
,
96
)),
testing
::
Values
(
MatType
(
CV_8UC1
),
MatType
(
CV_8UC
3
),
MatType
(
CV_8UC
4
))));
testing
::
Values
(
MatType
(
CV_8UC1
),
MatType
(
CV_8UC4
))));
#endif //HAVE_OPENCL
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录