Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
02bfd207
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,发现更多精彩内容 >>
提交
02bfd207
编写于
6月 08, 2019
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
imgcodecs(test): add OpenEXR I/O test
上级
254f88f8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
121 addition
and
0 deletion
+121
-0
modules/imgcodecs/test/test_exr.impl.hpp
modules/imgcodecs/test/test_exr.impl.hpp
+117
-0
modules/imgcodecs/test/test_grfmt.cpp
modules/imgcodecs/test/test_grfmt.cpp
+4
-0
未找到文件。
modules/imgcodecs/test/test_exr.impl.hpp
0 → 100644
浏览文件 @
02bfd207
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
//#define GENERATE_DATA
namespace
opencv_test
{
namespace
{
TEST
(
Imgcodecs_EXR
,
readWrite_32FC1
)
{
const
string
root
=
cvtest
::
TS
::
ptr
()
->
get_data_path
();
const
string
filenameInput
=
root
+
"readwrite/test32FC1.exr"
;
const
string
filenameOutput
=
cv
::
tempfile
(
".exr"
);
#ifndef GENERATE_DATA
const
Mat
img
=
cv
::
imread
(
filenameInput
,
IMREAD_UNCHANGED
);
#else
const
Size
sz
(
64
,
32
);
Mat
img
(
sz
,
CV_32FC1
,
Scalar
(
0.5
,
0.1
,
1
));
img
(
Rect
(
10
,
5
,
sz
.
width
-
30
,
sz
.
height
-
20
)).
setTo
(
Scalar
(
1
,
0
,
0
));
ASSERT_TRUE
(
cv
::
imwrite
(
filenameInput
,
img
));
#endif
ASSERT_FALSE
(
img
.
empty
());
ASSERT_EQ
(
CV_32FC1
,
img
.
type
());
ASSERT_TRUE
(
cv
::
imwrite
(
filenameOutput
,
img
));
const
Mat
img2
=
cv
::
imread
(
filenameOutput
,
IMREAD_UNCHANGED
);
ASSERT_EQ
(
img2
.
type
(),
img
.
type
());
ASSERT_EQ
(
img2
.
size
(),
img
.
size
());
EXPECT_LE
(
cvtest
::
norm
(
img
,
img2
,
NORM_INF
|
NORM_RELATIVE
),
1e-3
);
EXPECT_EQ
(
0
,
remove
(
filenameOutput
.
c_str
()));
}
TEST
(
Imgcodecs_EXR
,
readWrite_32FC3
)
{
const
string
root
=
cvtest
::
TS
::
ptr
()
->
get_data_path
();
const
string
filenameInput
=
root
+
"readwrite/test32FC3.exr"
;
const
string
filenameOutput
=
cv
::
tempfile
(
".exr"
);
#ifndef GENERATE_DATA
const
Mat
img
=
cv
::
imread
(
filenameInput
,
IMREAD_UNCHANGED
);
#else
const
Size
sz
(
64
,
32
);
Mat
img
(
sz
,
CV_32FC3
,
Scalar
(
0.5
,
0.1
,
1
));
img
(
Rect
(
10
,
5
,
sz
.
width
-
30
,
sz
.
height
-
20
)).
setTo
(
Scalar
(
1
,
0
,
0
));
ASSERT_TRUE
(
cv
::
imwrite
(
filenameInput
,
img
));
#endif
ASSERT_FALSE
(
img
.
empty
());
ASSERT_EQ
(
CV_32FC3
,
img
.
type
());
ASSERT_TRUE
(
cv
::
imwrite
(
filenameOutput
,
img
));
const
Mat
img2
=
cv
::
imread
(
filenameOutput
,
IMREAD_UNCHANGED
);
ASSERT_EQ
(
img2
.
type
(),
img
.
type
());
ASSERT_EQ
(
img2
.
size
(),
img
.
size
());
EXPECT_LE
(
cvtest
::
norm
(
img
,
img2
,
NORM_INF
|
NORM_RELATIVE
),
1e-3
);
EXPECT_EQ
(
0
,
remove
(
filenameOutput
.
c_str
()));
}
TEST
(
Imgcodecs_EXR
,
readWrite_32FC1_half
)
{
const
string
root
=
cvtest
::
TS
::
ptr
()
->
get_data_path
();
const
string
filenameInput
=
root
+
"readwrite/test32FC1_half.exr"
;
const
string
filenameOutput
=
cv
::
tempfile
(
".exr"
);
std
::
vector
<
int
>
params
;
params
.
push_back
(
IMWRITE_EXR_TYPE
);
params
.
push_back
(
IMWRITE_EXR_TYPE_HALF
);
#ifndef GENERATE_DATA
const
Mat
img
=
cv
::
imread
(
filenameInput
,
IMREAD_UNCHANGED
);
#else
const
Size
sz
(
64
,
32
);
Mat
img
(
sz
,
CV_32FC1
,
Scalar
(
0.5
,
0.1
,
1
));
img
(
Rect
(
10
,
5
,
sz
.
width
-
30
,
sz
.
height
-
20
)).
setTo
(
Scalar
(
1
,
0
,
0
));
ASSERT_TRUE
(
cv
::
imwrite
(
filenameInput
,
img
,
params
));
#endif
ASSERT_FALSE
(
img
.
empty
());
ASSERT_EQ
(
CV_32FC1
,
img
.
type
());
ASSERT_TRUE
(
cv
::
imwrite
(
filenameOutput
,
img
,
params
));
const
Mat
img2
=
cv
::
imread
(
filenameOutput
,
IMREAD_UNCHANGED
);
ASSERT_EQ
(
img2
.
type
(),
img
.
type
());
ASSERT_EQ
(
img2
.
size
(),
img
.
size
());
EXPECT_LE
(
cvtest
::
norm
(
img
,
img2
,
NORM_INF
|
NORM_RELATIVE
),
1e-3
);
EXPECT_EQ
(
0
,
remove
(
filenameOutput
.
c_str
()));
}
TEST
(
Imgcodecs_EXR
,
readWrite_32FC3_half
)
{
const
string
root
=
cvtest
::
TS
::
ptr
()
->
get_data_path
();
const
string
filenameInput
=
root
+
"readwrite/test32FC3_half.exr"
;
const
string
filenameOutput
=
cv
::
tempfile
(
".exr"
);
std
::
vector
<
int
>
params
;
params
.
push_back
(
IMWRITE_EXR_TYPE
);
params
.
push_back
(
IMWRITE_EXR_TYPE_HALF
);
#ifndef GENERATE_DATA
const
Mat
img
=
cv
::
imread
(
filenameInput
,
IMREAD_UNCHANGED
);
#else
const
Size
sz
(
64
,
32
);
Mat
img
(
sz
,
CV_32FC3
,
Scalar
(
0.5
,
0.1
,
1
));
img
(
Rect
(
10
,
5
,
sz
.
width
-
30
,
sz
.
height
-
20
)).
setTo
(
Scalar
(
1
,
0
,
0
));
ASSERT_TRUE
(
cv
::
imwrite
(
filenameInput
,
img
,
params
));
#endif
ASSERT_FALSE
(
img
.
empty
());
ASSERT_EQ
(
CV_32FC3
,
img
.
type
());
ASSERT_TRUE
(
cv
::
imwrite
(
filenameOutput
,
img
,
params
));
const
Mat
img2
=
cv
::
imread
(
filenameOutput
,
IMREAD_UNCHANGED
);
ASSERT_EQ
(
img2
.
type
(),
img
.
type
());
ASSERT_EQ
(
img2
.
size
(),
img
.
size
());
EXPECT_LE
(
cvtest
::
norm
(
img
,
img2
,
NORM_INF
|
NORM_RELATIVE
),
1e-3
);
EXPECT_EQ
(
0
,
remove
(
filenameOutput
.
c_str
()));
}
}}
// namespace
modules/imgcodecs/test/test_grfmt.cpp
浏览文件 @
02bfd207
...
...
@@ -352,3 +352,7 @@ TEST(Imgcodecs, write_parameter_type)
}
}}
// namespace
#ifdef HAVE_OPENEXR
#include "test_exr.impl.hpp"
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录