Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
4a0152c7
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,发现更多精彩内容 >>
提交
4a0152c7
编写于
7月 31, 2015
作者:
V
Vitaly Tuzov
提交者:
Dikay900
9月 21, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resize area result verification moved to the separate function
fix position of assert expected/actual parameter
上级
7d245e0f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
104 deletion
+49
-104
modules/imgproc/test/test_imgwarp.cpp
modules/imgproc/test/test_imgwarp.cpp
+49
-104
未找到文件。
modules/imgproc/test/test_imgwarp.cpp
浏览文件 @
4a0152c7
...
...
@@ -1372,6 +1372,49 @@ void CV_GetQuadSubPixTest::prepare_to_validation( int /*test_case_idx*/ )
dst
.
convertTo
(
dst0
,
dst0
.
depth
());
}
////////////////////////////// resizeArea /////////////////////////////////
template
<
typename
T
>
static
void
check_resize_area
(
const
Mat
&
expected
,
const
Mat
&
actual
,
double
tolerance
=
1.0
)
{
ASSERT_EQ
(
actual
.
type
(),
expected
.
type
());
ASSERT_EQ
(
actual
.
size
(),
expected
.
size
());
Mat
diff
;
absdiff
(
actual
,
expected
,
diff
);
Mat
one_channel_diff
=
diff
;
//.reshape(1);
Size
dsize
=
actual
.
size
();
bool
next
=
true
;
for
(
int
dy
=
0
;
dy
<
dsize
.
height
&&
next
;
++
dy
)
{
const
T
*
eD
=
expected
.
ptr
<
T
>
(
dy
);
const
T
*
aD
=
actual
.
ptr
<
T
>
(
dy
);
for
(
int
dx
=
0
;
dx
<
dsize
.
width
&&
next
;
++
dx
)
if
(
fabs
(
static_cast
<
double
>
(
aD
[
dx
]
-
eD
[
dx
]))
>
tolerance
)
{
cvtest
::
TS
::
ptr
()
->
printf
(
cvtest
::
TS
::
SUMMARY
,
"Inf norm: %f
\n
"
,
static_cast
<
float
>
(
norm
(
actual
,
expected
,
NORM_INF
)));
cvtest
::
TS
::
ptr
()
->
printf
(
cvtest
::
TS
::
SUMMARY
,
"Error in : (%d, %d)
\n
"
,
dx
,
dy
);
const
int
radius
=
3
;
int
rmin
=
MAX
(
dy
-
radius
,
0
),
rmax
=
MIN
(
dy
+
radius
,
dsize
.
height
);
int
cmin
=
MAX
(
dx
-
radius
,
0
),
cmax
=
MIN
(
dx
+
radius
,
dsize
.
width
);
std
::
cout
<<
"Abs diff:"
<<
std
::
endl
<<
diff
<<
std
::
endl
;
std
::
cout
<<
"actual result:
\n
"
<<
actual
(
Range
(
rmin
,
rmax
),
Range
(
cmin
,
cmax
))
<<
std
::
endl
;
std
::
cout
<<
"expected result:
\n
"
<<
expected
(
Range
(
rmin
,
rmax
),
Range
(
cmin
,
cmax
))
<<
std
::
endl
;
next
=
false
;
}
}
ASSERT_EQ
(
0
,
norm
(
one_channel_diff
,
cv
::
NORM_INF
));
}
///////////////////////////////////////////////////////////////////////////
TEST
(
Imgproc_cvWarpAffine
,
regression
)
{
IplImage
*
src
=
cvCreateImage
(
cvSize
(
100
,
100
),
IPL_DEPTH_8U
,
1
);
...
...
@@ -1501,52 +1544,18 @@ TEST(Imgproc_resize_area, regression)
cv
::
resize
(
src
,
actual
,
cv
::
Size
(),
0.3
,
0.3
,
INTER_AREA
);
ASSERT_EQ
(
actual
.
type
(),
expected
.
type
());
ASSERT_EQ
(
actual
.
size
(),
expected
.
size
());
Mat
diff
;
absdiff
(
actual
,
expected
,
diff
);
Mat
one_channel_diff
=
diff
;
//.reshape(1);
float
elem_diff
=
1.0
f
;
Size
dsize
=
actual
.
size
();
bool
next
=
true
;
for
(
int
dy
=
0
;
dy
<
dsize
.
height
&&
next
;
++
dy
)
{
ushort
*
eD
=
expected
.
ptr
<
ushort
>
(
dy
);
ushort
*
aD
=
actual
.
ptr
<
ushort
>
(
dy
);
for
(
int
dx
=
0
;
dx
<
dsize
.
width
&&
next
;
++
dx
)
if
(
fabs
(
static_cast
<
float
>
(
aD
[
dx
]
-
eD
[
dx
]))
>
elem_diff
)
{
cvtest
::
TS
::
ptr
()
->
printf
(
cvtest
::
TS
::
SUMMARY
,
"Inf norm: %f
\n
"
,
static_cast
<
float
>
(
norm
(
actual
,
expected
,
NORM_INF
)));
cvtest
::
TS
::
ptr
()
->
printf
(
cvtest
::
TS
::
SUMMARY
,
"Error in : (%d, %d)
\n
"
,
dx
,
dy
);
const
int
radius
=
3
;
int
rmin
=
MAX
(
dy
-
radius
,
0
),
rmax
=
MIN
(
dy
+
radius
,
dsize
.
height
);
int
cmin
=
MAX
(
dx
-
radius
,
0
),
cmax
=
MIN
(
dx
+
radius
,
dsize
.
width
);
std
::
cout
<<
"Abs diff:"
<<
std
::
endl
<<
diff
<<
std
::
endl
;
std
::
cout
<<
"actual result:
\n
"
<<
actual
(
Range
(
rmin
,
rmax
),
Range
(
cmin
,
cmax
))
<<
std
::
endl
;
std
::
cout
<<
"expected result:
\n
"
<<
expected
(
Range
(
rmin
,
rmax
),
Range
(
cmin
,
cmax
))
<<
std
::
endl
;
next
=
false
;
}
}
ASSERT_EQ
(
cvtest
::
norm
(
one_channel_diff
,
cv
::
NORM_INF
),
0
);
check_resize_area
<
ushort
>
(
expected
,
actual
,
1.0
);
}
TEST
(
Imgproc_resize_area
,
regression_half_round
)
{
static
uchar
input_data
[
32
*
32
];
for
(
int
i
=
0
;
i
<
32
*
32
;
++
i
)
input_data
[
i
]
=
i
%
2
+
253
+
i
/
(
16
*
32
);
input_data
[
i
]
=
(
uchar
)(
i
%
2
+
253
+
i
/
(
16
*
32
)
);
static
uchar
expected_data
[
16
*
16
];
for
(
int
i
=
0
;
i
<
16
*
16
;
++
i
)
expected_data
[
i
]
=
254
+
i
/
(
16
*
8
);
expected_data
[
i
]
=
(
uchar
)(
254
+
i
/
(
16
*
8
)
);
cv
::
Mat
src
(
32
,
32
,
CV_8UC1
,
input_data
);
cv
::
Mat
expected
(
16
,
16
,
CV_8UC1
,
expected_data
);
...
...
@@ -1554,46 +1563,14 @@ TEST(Imgproc_resize_area, regression_half_round)
cv
::
resize
(
src
,
actual
,
cv
::
Size
(),
0.5
,
0.5
,
INTER_AREA
);
ASSERT_EQ
(
actual
.
type
(),
expected
.
type
());
ASSERT_EQ
(
actual
.
size
(),
expected
.
size
());
Mat
diff
;
absdiff
(
actual
,
expected
,
diff
);
float
elem_diff
=
0.5
f
;
Size
dsize
=
actual
.
size
();
bool
next
=
true
;
for
(
int
dy
=
0
;
dy
<
dsize
.
height
&&
next
;
++
dy
)
{
uchar
*
eD
=
expected
.
ptr
<
uchar
>
(
dy
);
uchar
*
aD
=
actual
.
ptr
<
uchar
>
(
dy
);
for
(
int
dx
=
0
;
dx
<
dsize
.
width
&&
next
;
++
dx
)
if
(
fabs
(
static_cast
<
float
>
(
aD
[
dx
]
-
eD
[
dx
]))
>
elem_diff
)
{
cvtest
::
TS
::
ptr
()
->
printf
(
cvtest
::
TS
::
SUMMARY
,
"Inf norm: %f
\n
"
,
static_cast
<
float
>
(
norm
(
actual
,
expected
,
NORM_INF
)));
cvtest
::
TS
::
ptr
()
->
printf
(
cvtest
::
TS
::
SUMMARY
,
"Error in : (%d, %d)
\n
"
,
dx
,
dy
);
const
int
radius
=
3
;
int
rmin
=
MAX
(
dy
-
radius
,
0
),
rmax
=
MIN
(
dy
+
radius
,
dsize
.
height
);
int
cmin
=
MAX
(
dx
-
radius
,
0
),
cmax
=
MIN
(
dx
+
radius
,
dsize
.
width
);
std
::
cout
<<
"Abs diff:"
<<
std
::
endl
<<
diff
<<
std
::
endl
;
std
::
cout
<<
"actual result:
\n
"
<<
actual
(
Range
(
rmin
,
rmax
),
Range
(
cmin
,
cmax
))
<<
std
::
endl
;
std
::
cout
<<
"expected result:
\n
"
<<
expected
(
Range
(
rmin
,
rmax
),
Range
(
cmin
,
cmax
))
<<
std
::
endl
;
next
=
false
;
}
}
ASSERT_EQ
(
norm
(
diff
,
cv
::
NORM_INF
),
0
);
check_resize_area
<
uchar
>
(
expected
,
actual
,
0.5
);
}
TEST
(
Imgproc_resize_area
,
regression_quarter_round
)
{
static
uchar
input_data
[
32
*
32
];
for
(
int
i
=
0
;
i
<
32
*
32
;
++
i
)
input_data
[
i
]
=
i
%
2
+
253
+
i
/
(
16
*
32
);
input_data
[
i
]
=
(
uchar
)(
i
%
2
+
253
+
i
/
(
16
*
32
)
);
static
uchar
expected_data
[
8
*
8
];
for
(
int
i
=
0
;
i
<
8
*
8
;
++
i
)
...
...
@@ -1605,39 +1582,7 @@ TEST(Imgproc_resize_area, regression_quarter_round)
cv
::
resize
(
src
,
actual
,
cv
::
Size
(),
0.25
,
0.25
,
INTER_AREA
);
ASSERT_EQ
(
actual
.
type
(),
expected
.
type
());
ASSERT_EQ
(
actual
.
size
(),
expected
.
size
());
Mat
diff
;
absdiff
(
actual
,
expected
,
diff
);
float
elem_diff
=
0.5
f
;
Size
dsize
=
actual
.
size
();
bool
next
=
true
;
for
(
int
dy
=
0
;
dy
<
dsize
.
height
&&
next
;
++
dy
)
{
uchar
*
eD
=
expected
.
ptr
<
uchar
>
(
dy
);
uchar
*
aD
=
actual
.
ptr
<
uchar
>
(
dy
);
for
(
int
dx
=
0
;
dx
<
dsize
.
width
&&
next
;
++
dx
)
if
(
fabs
(
static_cast
<
float
>
(
aD
[
dx
]
-
eD
[
dx
]))
>
elem_diff
)
{
cvtest
::
TS
::
ptr
()
->
printf
(
cvtest
::
TS
::
SUMMARY
,
"Inf norm: %f
\n
"
,
static_cast
<
float
>
(
norm
(
actual
,
expected
,
NORM_INF
)));
cvtest
::
TS
::
ptr
()
->
printf
(
cvtest
::
TS
::
SUMMARY
,
"Error in : (%d, %d)
\n
"
,
dx
,
dy
);
const
int
radius
=
3
;
int
rmin
=
MAX
(
dy
-
radius
,
0
),
rmax
=
MIN
(
dy
+
radius
,
dsize
.
height
);
int
cmin
=
MAX
(
dx
-
radius
,
0
),
cmax
=
MIN
(
dx
+
radius
,
dsize
.
width
);
std
::
cout
<<
"Abs diff:"
<<
std
::
endl
<<
diff
<<
std
::
endl
;
std
::
cout
<<
"actual result:
\n
"
<<
actual
(
Range
(
rmin
,
rmax
),
Range
(
cmin
,
cmax
))
<<
std
::
endl
;
std
::
cout
<<
"expected result:
\n
"
<<
expected
(
Range
(
rmin
,
rmax
),
Range
(
cmin
,
cmax
))
<<
std
::
endl
;
next
=
false
;
}
}
ASSERT_EQ
(
norm
(
diff
,
cv
::
NORM_INF
),
0
);
check_resize_area
<
uchar
>
(
expected
,
actual
,
0.5
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录