Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
41431e11
Commit
41431e11
authored
Jul 20, 2016
by
Dimitrios Katsaros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Imgcodecs: Implemented simple tests for PAM format
parent
4e513a33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
test_grfmt.cpp
modules/imgcodecs/test/test_grfmt.cpp
+27
-1
No files found.
modules/imgcodecs/test/test_grfmt.cpp
View file @
41431e11
...
...
@@ -44,6 +44,7 @@
#include <fstream>
#include <sstream>
#include <iostream>
using
namespace
cv
;
using
namespace
std
;
...
...
@@ -308,6 +309,7 @@ string ext_from_int(int ext)
#ifdef HAVE_TIFF
if
(
ext
==
3
)
return
".tiff"
;
#endif
if
(
ext
==
4
)
return
".pam"
;
return
""
;
}
...
...
@@ -323,7 +325,7 @@ public:
for
(
int
k
=
1
;
k
<=
5
;
++
k
)
{
for
(
int
ext
=
0
;
ext
<
4
;
++
ext
)
// 0 - png, 1 - bmp, 2 - pgm, 3 - tiff
for
(
int
ext
=
0
;
ext
<
5
;
++
ext
)
// 0 - png, 1 - bmp, 2 - pgm, 3 - tiff
{
if
(
ext_from_int
(
ext
).
empty
())
continue
;
...
...
@@ -1017,3 +1019,27 @@ TEST(Imgcodecs_Hdr, regression)
ASSERT_FALSE
(
max
>
DBL_EPSILON
);
}
}
TEST
(
Imgcodecs_Pam
,
readwrite
)
{
string
folder
=
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"readwrite/"
;
string
filepath
=
folder
+
"lena.pam"
;
cv
::
Mat
img
=
cv
::
imread
(
filepath
);
ASSERT_FALSE
(
img
.
empty
());
std
::
vector
<
int
>
params
;
params
.
push_back
(
IMWRITE_PAM_TUPLETYPE
);
params
.
push_back
(
IMWRITE_PAM_FORMAT_RGB
);
string
writefile
=
cv
::
tempfile
(
".pam"
);
EXPECT_NO_THROW
(
cv
::
imwrite
(
writefile
,
img
,
params
));
cv
::
Mat
reread
=
cv
::
imread
(
writefile
);
string
writefile_no_param
=
cv
::
tempfile
(
".pam"
);
EXPECT_NO_THROW
(
cv
::
imwrite
(
writefile_no_param
,
img
));
cv
::
Mat
reread_no_param
=
cv
::
imread
(
writefile_no_param
);
EXPECT_EQ
(
0
,
cvtest
::
norm
(
reread
,
reread_no_param
,
NORM_INF
));
EXPECT_EQ
(
0
,
cvtest
::
norm
(
img
,
reread
,
NORM_INF
));
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment