Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cvLoadImage and imread do not handle exif orientation similarly #6673

Closed
guillaume-tgl opened this issue Jun 13, 2016 · 3 comments
Closed

cvLoadImage and imread do not handle exif orientation similarly #6673

guillaume-tgl opened this issue Jun 13, 2016 · 3 comments

Comments

@guillaume-tgl
Copy link
Contributor

Please state the information for your system

  • OpenCV version: 3.1
  • Host OS: Mac OS X 10.11.4

In which part of the OpenCV library you got the issue?

Examples:

  • imgcodecs
  • reading an image with exif orientation

Expected behaviour

Since OpenCV 3.1, exif orientation is now used to rotate images properly. imread and cvLoadImage should output an image rotated accordingly to the exif orientation.

Actual behaviour

imread outputs an image with correct orientation, cvLoadImage seems to ignore the exif orientation, though they seem to call the same internal method to read a JPEG image.

Code example to reproduce the issue / Steps to reproduce the issue

Please try to give a full example which will compile as is.

#include <opencv2/opencv.hpp>
#include <opencv/highgui.h>

int main(int argc, char** argv){

   IplImage* image = cvLoadImage("input.jpg", CV_LOAD_IMAGE_COLOR);
   cvSaveImage("output_cvloadImage.jpg", image);

   Mat mat = imread("input.jpg", CV_LOAD_IMAGE_COLOR);
   imwrite("output_imread.jpg", mat);

   return 0;
}

input.jpg is portrait with Orientation: 6 (Rotated 90° CCW)
output_cvloadImage.jpg is landscape
output_imread.jpg is portrait

@ilya-lavrenov
Copy link
Contributor

@guillaume-tgl, could you attach an image to test on?

@guillaume-tgl
Copy link
Contributor Author

guillaume-tgl commented Jul 18, 2016

Sure :
20160718_093349

@alalek
Copy link
Member

alalek commented Jul 18, 2016

C API ("cv" prefix) is obsolete and should not be used in new programs, but there are still some programs which use it. So it is unwanted to change existed behaviour.
Related issue of changed behaviour: #6348

I prefer to leave this "as is": cv::imread uses EXIF (by default, until we add control flag for this behaviour), cvLoadImage doesn't use EXIF information.

@asmorkalov asmorkalov added Hackathon https://opencv.org/opencv-hackathon-starts-next-week/ and removed Hackathon https://opencv.org/opencv-hackathon-starts-next-week/ labels Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants