Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
8b57893e
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,发现更多精彩内容 >>
提交
8b57893e
编写于
11月 08, 2013
作者:
I
Ilya Lavrenov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added an accuracy test for ocl::buildWarpPerspectiveMaps
上级
4248f822
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
110 addition
and
0 deletion
+110
-0
modules/ocl/test/test_warp.cpp
modules/ocl/test/test_warp.cpp
+110
-0
未找到文件。
modules/ocl/test/test_warp.cpp
浏览文件 @
8b57893e
...
...
@@ -156,6 +156,114 @@ OCL_TEST_P(WarpPerspective, Mat)
}
}
// buildWarpPerspectiveMaps
PARAM_TEST_CASE
(
BuildWarpPerspectiveMaps
,
bool
,
bool
)
{
bool
useRoi
,
mapInverse
;
Size
dsize
;
Mat
xmap_whole
,
ymap_whole
,
xmap_roi
,
ymap_roi
;
ocl
::
oclMat
gxmap_whole
,
gymap_whole
,
gxmap_roi
,
gymap_roi
;
void
SetUp
()
{
mapInverse
=
GET_PARAM
(
0
);
useRoi
=
GET_PARAM
(
1
);
}
void
random_roi
()
{
dsize
=
randomSize
(
1
,
MAX_VALUE
);
Border
xmapBorder
=
randomBorder
(
0
,
useRoi
?
MAX_VALUE
:
0
);
randomSubMat
(
xmap_whole
,
xmap_roi
,
dsize
,
xmapBorder
,
CV_32FC1
,
-
MAX_VALUE
,
MAX_VALUE
);
Border
ymapBorder
=
randomBorder
(
0
,
useRoi
?
MAX_VALUE
:
0
);
randomSubMat
(
ymap_whole
,
ymap_roi
,
dsize
,
ymapBorder
,
CV_32FC1
,
-
MAX_VALUE
,
MAX_VALUE
);
generateOclMat
(
gxmap_whole
,
gxmap_roi
,
xmap_whole
,
dsize
,
xmapBorder
);
generateOclMat
(
gymap_whole
,
gymap_roi
,
ymap_whole
,
dsize
,
ymapBorder
);
}
void
Near
(
double
threshold
=
0.0
)
{
Mat
whole
,
roi
;
gxmap_whole
.
download
(
whole
);
gxmap_roi
.
download
(
roi
);
EXPECT_MAT_NEAR
(
xmap_whole
,
whole
,
threshold
);
EXPECT_MAT_NEAR
(
xmap_roi
,
roi
,
threshold
);
}
void
Near1
(
double
threshold
=
0.0
)
{
Mat
whole
,
roi
;
gymap_whole
.
download
(
whole
);
gymap_roi
.
download
(
roi
);
EXPECT_MAT_NEAR
(
ymap_whole
,
whole
,
threshold
);
EXPECT_MAT_NEAR
(
ymap_roi
,
roi
,
threshold
);
}
};
static
void
buildWarpPerspectiveMaps
(
const
Mat
&
M
,
bool
inverse
,
Size
dsize
,
Mat
&
xmap
,
Mat
&
ymap
)
{
CV_Assert
(
M
.
rows
==
3
&&
M
.
cols
==
3
);
CV_Assert
(
dsize
.
area
()
>
0
);
xmap
.
create
(
dsize
,
CV_32FC1
);
ymap
.
create
(
dsize
,
CV_32FC1
);
float
coeffs
[
3
*
3
];
Mat
coeffsMat
(
3
,
3
,
CV_32F
,
(
void
*
)
coeffs
);
if
(
inverse
)
M
.
convertTo
(
coeffsMat
,
coeffsMat
.
type
());
else
{
cv
::
Mat
iM
;
invert
(
M
,
iM
);
iM
.
convertTo
(
coeffsMat
,
coeffsMat
.
type
());
}
for
(
int
y
=
0
;
y
<
dsize
.
height
;
++
y
)
{
float
*
const
xmap_ptr
=
xmap
.
ptr
<
float
>
(
y
);
float
*
const
ymap_ptr
=
ymap
.
ptr
<
float
>
(
y
);
for
(
int
x
=
0
;
x
<
dsize
.
width
;
++
x
)
{
float
coeff
=
1.0
f
/
(
x
*
coeffs
[
6
]
+
y
*
coeffs
[
7
]
+
coeffs
[
8
]);
xmap_ptr
[
x
]
=
(
x
*
coeffs
[
0
]
+
y
*
coeffs
[
1
]
+
coeffs
[
2
])
*
coeff
;
ymap_ptr
[
x
]
=
(
x
*
coeffs
[
3
]
+
y
*
coeffs
[
4
]
+
coeffs
[
5
])
*
coeff
;
}
}
}
OCL_TEST_P
(
BuildWarpPerspectiveMaps
,
Mat
)
{
for
(
int
j
=
0
;
j
<
LOOP_TIMES
;
j
++
)
{
random_roi
();
float
cols
=
static_cast
<
float
>
(
MAX_VALUE
),
rows
=
static_cast
<
float
>
(
MAX_VALUE
);
float
cols2
=
cols
/
2.0
f
,
rows2
=
rows
/
2.0
f
;
Point2f
sp
[]
=
{
Point2f
(
0.0
f
,
0.0
f
),
Point2f
(
cols
,
0.0
f
),
Point2f
(
0.0
f
,
rows
),
Point2f
(
cols
,
rows
)
};
Point2f
dp
[]
=
{
Point2f
(
rng
.
uniform
(
0.0
f
,
cols2
),
rng
.
uniform
(
0.0
f
,
rows2
)),
Point2f
(
rng
.
uniform
(
cols2
,
cols
),
rng
.
uniform
(
0.0
f
,
rows2
)),
Point2f
(
rng
.
uniform
(
0.0
f
,
cols2
),
rng
.
uniform
(
rows2
,
rows
)),
Point2f
(
rng
.
uniform
(
cols2
,
cols
),
rng
.
uniform
(
rows2
,
rows
))
};
Mat
M
=
getPerspectiveTransform
(
sp
,
dp
);
buildWarpPerspectiveMaps
(
M
,
mapInverse
,
dsize
,
xmap_roi
,
ymap_roi
);
ocl
::
buildWarpPerspectiveMaps
(
M
,
mapInverse
,
dsize
,
gxmap_roi
,
gymap_roi
);
Near
(
1e-6
);
Near1
(
1e-6
);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
// remap
...
...
@@ -338,6 +446,8 @@ INSTANTIATE_TEST_CASE_P(ImgprocWarp, WarpPerspective, Combine(
Bool
(),
Bool
()));
INSTANTIATE_TEST_CASE_P
(
ImgprocWarp
,
BuildWarpPerspectiveMaps
,
Combine
(
Bool
(),
Bool
()));
INSTANTIATE_TEST_CASE_P
(
ImgprocWarp
,
Remap_INTER_LINEAR
,
Combine
(
Values
(
CV_8U
,
CV_16U
,
CV_16S
,
CV_32F
,
CV_64F
),
Values
(
1
,
2
,
3
,
4
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录