Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
eb012a59
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,发现更多精彩内容 >>
提交
eb012a59
编写于
3月 07, 2013
作者:
A
AoD314
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added tests for WebP
上级
63d9ee95
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
91 addition
and
0 deletion
+91
-0
modules/highgui/test/test_grfmt.cpp
modules/highgui/test/test_grfmt.cpp
+91
-0
未找到文件。
modules/highgui/test/test_grfmt.cpp
浏览文件 @
eb012a59
...
...
@@ -332,3 +332,94 @@ TEST(Highgui_Tiff, decode_tile16384x16384)
remove
(
file4
.
c_str
());
}
#endif
#ifdef HAVE_WEBP
TEST
(
Highgui_WebP
,
encode_decode_lossless_webp
)
{
cvtest
::
TS
&
ts
=
*
cvtest
::
TS
::
ptr
();
std
::
string
input
=
std
::
string
(
ts
.
get_data_path
())
+
"../cv/shared/lena.png"
;
cv
::
Mat
img
=
cv
::
imread
(
input
);
ASSERT_FALSE
(
img
.
empty
());
std
::
string
output
=
cv
::
tempfile
(
".webp"
);
EXPECT_NO_THROW
(
cv
::
imwrite
(
output
,
img
));
// lossless
cv
::
Mat
img_webp
=
cv
::
imread
(
output
);
std
::
vector
<
unsigned
char
>
buf
;
FILE
*
wfile
=
NULL
;
wfile
=
fopen
(
output
.
c_str
(),
"rb"
);
if
(
wfile
!=
NULL
)
{
fseek
(
wfile
,
0
,
SEEK_END
);
size_t
wfile_size
=
ftell
(
wfile
);
fseek
(
wfile
,
0
,
SEEK_SET
);
buf
.
resize
(
wfile_size
);
size_t
data_size
=
fread
(
&
buf
[
0
],
1
,
wfile_size
,
wfile
);
if
(
wfile
)
{
fclose
(
wfile
);
}
if
(
data_size
!=
wfile_size
)
{
EXPECT_TRUE
(
false
);
}
}
cv
::
Mat
decode
=
cv
::
imdecode
(
buf
,
CV_LOAD_IMAGE_COLOR
);
ASSERT_FALSE
(
decode
.
empty
());
EXPECT_TRUE
(
cv
::
norm
(
decode
,
img_webp
,
NORM_INF
)
==
0
);
ASSERT_FALSE
(
img_webp
.
empty
());
EXPECT_TRUE
(
cv
::
norm
(
img
,
img_webp
,
NORM_INF
)
==
0
);
}
TEST
(
Highgui_WebP
,
encode_decode_lossy_webp
)
{
cvtest
::
TS
&
ts
=
*
cvtest
::
TS
::
ptr
();
std
::
string
input
=
std
::
string
(
ts
.
get_data_path
())
+
"/../cv/shared/lena.png"
;
cv
::
Mat
img
=
cv
::
imread
(
input
);
ASSERT_FALSE
(
img
.
empty
());
for
(
int
q
=
100
;
q
>=
0
;
q
-=
5
)
{
std
::
vector
<
int
>
params
;
params
.
push_back
(
CV_IMWRITE_WEBP_QUALITY
);
params
.
push_back
(
q
);
string
output
=
cv
::
tempfile
(
".webp"
);
EXPECT_NO_THROW
(
cv
::
imwrite
(
output
,
img
,
params
));
cv
::
Mat
img_webp
=
cv
::
imread
(
output
);
EXPECT_FALSE
(
img_webp
.
empty
());
}
}
TEST
(
Highgui_WebP
,
encode_big_image_webp
)
{
cvtest
::
TS
&
ts
=
*
cvtest
::
TS
::
ptr
();
std
::
string
input
=
std
::
string
(
ts
.
get_data_path
())
+
"/../cv/shared/lena.png"
;
cv
::
Mat
img
=
cv
::
imread
(
input
);
cv
::
resize
(
img
,
img
,
cv
::
Size
(
8192
,
8192
));
std
::
vector
<
int
>
params
;
params
.
push_back
(
CV_IMWRITE_WEBP_QUALITY
);
params
.
push_back
(
95
);
std
::
string
output
=
cv
::
tempfile
(
".webp"
);
EXPECT_NO_THROW
(
cv
::
imwrite
(
output
,
img
,
params
));
img
.
create
(
10000
,
10000
,
CV_8UC3
);
cv
::
randu
(
img
,
0
,
256
);
output
=
cv
::
tempfile
(
".webp"
);
EXPECT_NO_THROW
(
cv
::
imwrite
(
output
,
img
));
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录