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
120b7a61
Commit
120b7a61
authored
Feb 20, 2018
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10745 from terfendail:tiff_fix
parents
470d34dd
24ee7b50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
grfmt_tiff.cpp
modules/imgcodecs/src/grfmt_tiff.cpp
+7
-2
No files found.
modules/imgcodecs/src/grfmt_tiff.cpp
View file @
120b7a61
...
...
@@ -300,7 +300,6 @@ bool TiffDecoder::readData( Mat& img )
}
bool
result
=
false
;
bool
color
=
img
.
channels
()
>
1
;
uchar
*
data
=
img
.
ptr
();
if
(
img
.
depth
()
!=
CV_8U
&&
img
.
depth
()
!=
CV_16U
&&
img
.
depth
()
!=
CV_32F
&&
img
.
depth
()
!=
CV_64F
)
return
false
;
...
...
@@ -316,6 +315,10 @@ bool TiffDecoder::readData( Mat& img )
uint16
bpp
=
8
,
ncn
=
photometric
>
1
?
3
:
1
;
TIFFGetField
(
tif
,
TIFFTAG_BITSPERSAMPLE
,
&
bpp
);
TIFFGetField
(
tif
,
TIFFTAG_SAMPLESPERPIXEL
,
&
ncn
);
uint16
img_orientation
=
ORIENTATION_TOPLEFT
;
TIFFGetField
(
tif
,
TIFFTAG_ORIENTATION
,
&
img_orientation
);
bool
vert_flip
=
(
img_orientation
==
ORIENTATION_BOTRIGHT
)
||
(
img_orientation
==
ORIENTATION_RIGHTBOT
)
||
(
img_orientation
==
ORIENTATION_BOTLEFT
)
||
(
img_orientation
==
ORIENTATION_LEFTBOT
);
const
int
bitsPerByte
=
8
;
int
dst_bpp
=
(
int
)(
img
.
elemSize1
()
*
bitsPerByte
);
int
wanted_channels
=
normalizeChannelsNumber
(
img
.
channels
());
...
...
@@ -358,13 +361,15 @@ bool TiffDecoder::readData( Mat& img )
double
*
buffer64
=
(
double
*
)
buffer
;
int
tileidx
=
0
;
for
(
y
=
0
;
y
<
m_height
;
y
+=
tile_height0
,
data
+=
img
.
step
*
tile_height0
)
for
(
y
=
0
;
y
<
m_height
;
y
+=
tile_height0
)
{
int
tile_height
=
tile_height0
;
if
(
y
+
tile_height
>
m_height
)
tile_height
=
m_height
-
y
;
uchar
*
data
=
img
.
ptr
(
vert_flip
?
m_height
-
y
-
tile_height
:
y
);
for
(
x
=
0
;
x
<
m_width
;
x
+=
tile_width0
,
tileidx
++
)
{
int
tile_width
=
tile_width0
,
ok
;
...
...
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