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
caa03f72
Commit
caa03f72
authored
Apr 05, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3694 from Ashod:jp2
parents
085b4ca7
f75f2ffd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
19 deletions
+56
-19
jas_cm.c
3rdparty/libjasper/jas_cm.c
+0
-1
jas_stream.c
3rdparty/libjasper/jas_stream.c
+5
-2
grfmt_jpeg2000.cpp
modules/imgcodecs/src/grfmt_jpeg2000.cpp
+24
-1
loadsave.cpp
modules/imgcodecs/src/loadsave.cpp
+1
-8
test_grfmt.cpp
modules/imgcodecs/test/test_grfmt.cpp
+26
-7
No files found.
3rdparty/libjasper/jas_cm.c
View file @
caa03f72
...
...
@@ -842,7 +842,6 @@ static int jas_cmshapmat_apply(jas_cmpxform_t *pxform, jas_cmreal_t *in,
*
dst
++
=
a2
;
}
}
else
{
assert
(
0
);
while
(
--
cnt
>=
0
)
{
a0
=
*
src
++
;
src
++
;
...
...
3rdparty/libjasper/jas_stream.c
View file @
caa03f72
...
...
@@ -345,6 +345,7 @@ jas_stream_t *jas_stream_tmpfile()
{
jas_stream_t
*
stream
;
jas_stream_fileobj_t
*
obj
;
char
*
tmpname
;
if
(
!
(
stream
=
jas_stream_create
()))
{
return
0
;
...
...
@@ -365,10 +366,12 @@ jas_stream_t *jas_stream_tmpfile()
#ifdef _WIN32
/* Choose a file name. */
tmpnam
(
obj
->
pathname
);
tmpname
=
tempnam
(
NULL
,
NULL
);
strcpy
(
obj
->
pathname
,
tmpname
);
free
(
tmpname
);
/* Open the underlying file. */
if
((
obj
->
fd
=
open
(
obj
->
pathname
,
O_CREAT
|
O_EXCL
|
O_RDWR
|
O_TRUNC
|
O_BINARY
,
if
((
obj
->
fd
=
open
(
obj
->
pathname
,
O_CREAT
|
O_EXCL
|
O_RDWR
|
O_TRUNC
|
O_BINARY
|
O_TEMPORARY
|
_O_SHORT_LIVED
,
JAS_STREAM_PERMS
))
<
0
)
{
jas_stream_destroy
(
stream
);
return
0
;
...
...
modules/imgcodecs/src/grfmt_jpeg2000.cpp
View file @
caa03f72
...
...
@@ -45,6 +45,7 @@
#ifdef HAVE_JASPER
#include "grfmt_jpeg2000.hpp"
#include "opencv2/imgproc.hpp"
#ifdef WIN32
#define JAS_WIN_MSVC_BUILD 1
...
...
@@ -159,6 +160,21 @@ bool Jpeg2KDecoder::readData( Mat& img )
jas_stream_t
*
stream
=
(
jas_stream_t
*
)
m_stream
;
jas_image_t
*
image
=
(
jas_image_t
*
)
m_image
;
#ifndef WIN32
// At least on some Linux instances the
// system libjasper segfaults when
// converting color to grey.
// We do this conversion manually at the end.
Mat
clr
;
if
(
CV_MAT_CN
(
img
.
type
())
<
CV_MAT_CN
(
this
->
type
()))
{
clr
.
create
(
img
.
size
().
height
,
img
.
size
().
width
,
this
->
type
());
color
=
true
;
data
=
clr
.
ptr
();
step
=
(
int
)
clr
.
step
;
}
#endif
if
(
stream
&&
image
)
{
bool
convert
;
...
...
@@ -171,7 +187,7 @@ bool Jpeg2KDecoder::readData( Mat& img )
else
{
convert
=
(
jas_clrspc_fam
(
jas_image_clrspc
(
image
)
)
!=
JAS_CLRSPC_FAM_GRAY
);
colorspace
=
JAS_CLRSPC_SGRAY
;
// TODO GENGRAY or SGRAY?
colorspace
=
JAS_CLRSPC_SGRAY
;
// TODO GENGRAY or SGRAY?
(GENGRAY fails on Win.)
}
// convert to the desired colorspace
...
...
@@ -256,6 +272,13 @@ bool Jpeg2KDecoder::readData( Mat& img )
close
();
#ifndef WIN32
if
(
!
clr
.
empty
())
{
cv
::
cvtColor
(
clr
,
img
,
COLOR_BGR2GRAY
);
}
#endif
return
result
;
}
...
...
modules/imgcodecs/src/loadsave.cpp
View file @
caa03f72
...
...
@@ -374,15 +374,8 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats)
type
=
CV_MAKETYPE
(
CV_MAT_DEPTH
(
type
),
1
);
}
// established the required input image size.
CvSize
size
;
size
.
width
=
decoder
->
width
();
size
.
height
=
decoder
->
height
();
Mat
mat
;
mat
.
create
(
size
.
height
,
size
.
width
,
type
);
// read the image data
Mat
mat
(
decoder
->
height
(),
decoder
->
width
(),
type
);
if
(
!
decoder
->
readData
(
mat
))
{
break
;
...
...
modules/imgcodecs/test/test_grfmt.cpp
View file @
caa03f72
...
...
@@ -87,6 +87,9 @@ TEST(Imgcodecs_imread, regression)
{
const
char
*
const
filenames
[]
=
{
#ifdef HAVE_JASPER
"Rome.jp2"
,
#endif
"color_palette_alpha.png"
,
"multipage.tif"
,
"rle.hdr"
,
...
...
@@ -99,16 +102,32 @@ TEST(Imgcodecs_imread, regression)
for
(
size_t
i
=
0
;
i
<
sizeof
(
filenames
)
/
sizeof
(
filenames
[
0
]);
++
i
)
{
ASSERT_TRUE
(
imread_compare
(
folder
+
string
(
filenames
[
i
]),
IMREAD_UNCHANGED
));
ASSERT_TRUE
(
imread_compare
(
folder
+
string
(
filenames
[
i
]),
IMREAD_GRAYSCALE
));
ASSERT_TRUE
(
imread_compare
(
folder
+
string
(
filenames
[
i
]),
IMREAD_COLOR
));
ASSERT_TRUE
(
imread_compare
(
folder
+
string
(
filenames
[
i
]),
IMREAD_ANYDEPTH
));
ASSERT_TRUE
(
imread_compare
(
folder
+
string
(
filenames
[
i
]),
IMREAD_ANYCOLOR
));
if
(
i
!=
2
)
// GDAL does not support hdr
ASSERT_TRUE
(
imread_compare
(
folder
+
string
(
filenames
[
i
]),
IMREAD_LOAD_GDAL
));
const
string
path
=
folder
+
string
(
filenames
[
i
]);
ASSERT_TRUE
(
imread_compare
(
path
,
IMREAD_UNCHANGED
));
ASSERT_TRUE
(
imread_compare
(
path
,
IMREAD_GRAYSCALE
));
ASSERT_TRUE
(
imread_compare
(
path
,
IMREAD_COLOR
));
ASSERT_TRUE
(
imread_compare
(
path
,
IMREAD_ANYDEPTH
));
ASSERT_TRUE
(
imread_compare
(
path
,
IMREAD_ANYCOLOR
));
if
(
path
.
substr
(
path
.
length
()
-
3
)
!=
"hdr"
)
{
// GDAL does not support hdr
ASSERT_TRUE
(
imread_compare
(
path
,
IMREAD_LOAD_GDAL
));
}
}
}
#ifdef HAVE_JASPER
TEST
(
Imgcodecs_jasper
,
regression
)
{
const
string
folder
=
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"/readwrite/"
;
ASSERT_TRUE
(
imread_compare
(
folder
+
"Bretagne2.jp2"
,
IMREAD_COLOR
));
ASSERT_TRUE
(
imread_compare
(
folder
+
"Bretagne2.jp2"
,
IMREAD_GRAYSCALE
));
ASSERT_TRUE
(
imread_compare
(
folder
+
"Grey.jp2"
,
IMREAD_COLOR
));
ASSERT_TRUE
(
imread_compare
(
folder
+
"Grey.jp2"
,
IMREAD_GRAYSCALE
));
}
#endif
class
CV_GrfmtWriteBigImageTest
:
public
cvtest
::
BaseTest
{
public
:
...
...
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