Skip to content

IMRead() with IMReadUnchanged flag ignores EXIF orientation, when it should preserve it #15786

@Alexn117

Description

@Alexn117
System information (version)
  • OpenCV => 4.1.2
  • Operating System / Platform => macOS Catalina version: 10.15
  • Compiler => gocv version: 0.21.0
Detailed description

The documentation seems to indicate that an image's EXIF orientation will be preserved, unless the IMREAD_IGNORE_ORIENTATION flag is set. But when I set the IMREAD_UNCHANGED flag, the EXIF orientation is also not preserved. Strangely, if I use IMREAD_COLOR, it is preserved.

If EXIF information are embedded in the image file, the EXIF orientation will be taken into account and thus the image will be rotated accordingly except if the flag IMREAD_IGNORE_ORIENTATION is passed.
https://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56

IMREAD_IGNORE_ORIENTATION | If set, do not rotate the image according to EXIF's orientation flag.
https://docs.opencv.org/master/d4/da8/group__imgcodecs.html#ga61d9b0126a3e57d9277ac48327799c80

Steps to reproduce

EXIF orientation is ignored, even though the IMREAD_IGNORE_ORIENTATION flag is not being set:

img := gocv.IMRead(name, gocv.IMReadUnchanged)

EXIF orientation is preserved:

img := gocv.IMRead(name, gocv.IMReadColor)

EDIT: sample image
IMG_3543 - no location

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions