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
9ab59fb2
Commit
9ab59fb2
authored
Nov 10, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5645 from jia-kai:master
parents
7b022371
80df9dde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
5 deletions
+25
-5
jpeg_exif.cpp
modules/imgcodecs/src/jpeg_exif.cpp
+25
-5
No files found.
modules/imgcodecs/src/jpeg_exif.cpp
View file @
9ab59fb2
...
...
@@ -42,6 +42,13 @@
#include "jpeg_exif.hpp"
namespace
{
class
ExifParsingError
{
};
}
namespace
cv
{
...
...
@@ -66,12 +73,16 @@ ExifReader::~ExifReader()
*/
bool
ExifReader
::
parse
()
{
m_exif
=
getExif
();
if
(
!
m_exif
.
empty
()
)
{
return
true
;
try
{
m_exif
=
getExif
();
if
(
!
m_exif
.
empty
()
)
{
return
true
;
}
return
false
;
}
catch
(
ExifParsingError
&
)
{
return
false
;
}
return
false
;
}
...
...
@@ -147,6 +158,9 @@ std::map<int, ExifEntry_t > ExifReader::getExif()
case
APP1
:
//actual Exif Marker
exifSize
=
getFieldSize
(
f
);
if
(
exifSize
<=
offsetToTiffHeader
)
{
throw
ExifParsingError
();
}
m_data
.
resize
(
exifSize
-
offsetToTiffHeader
);
fseek
(
f
,
static_cast
<
long
>
(
offsetToTiffHeader
),
SEEK_CUR
);
count
=
fread
(
&
m_data
[
0
],
sizeof
(
unsigned
char
),
exifSize
-
offsetToTiffHeader
,
f
);
...
...
@@ -401,6 +415,9 @@ std::string ExifReader::getString(const size_t offset) const
*/
uint16_t
ExifReader
::
getU16
(
const
size_t
offset
)
const
{
if
(
offset
+
1
>=
m_data
.
size
())
throw
ExifParsingError
();
if
(
m_format
==
INTEL
)
{
return
m_data
[
offset
]
+
(
m_data
[
offset
+
1
]
<<
8
);
...
...
@@ -416,6 +433,9 @@ uint16_t ExifReader::getU16(const size_t offset) const
*/
uint32_t
ExifReader
::
getU32
(
const
size_t
offset
)
const
{
if
(
offset
+
3
>=
m_data
.
size
())
throw
ExifParsingError
();
if
(
m_format
==
INTEL
)
{
return
m_data
[
offset
]
+
...
...
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