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

Support for reading images in correct orientation using EXIF data. #1706

Open
RafayAK opened this issue Mar 28, 2019 · 5 comments
Open

Support for reading images in correct orientation using EXIF data. #1706

RafayAK opened this issue Mar 28, 2019 · 5 comments

Comments

@RafayAK
Copy link

RafayAK commented Mar 28, 2019

Current Behavior

I'm working on image processing with some images I collected myself. Dlib's dlib.load_rgb_image('image_path') method swaps the rows and columns on some images while OpenCV's cv2.imread('image_path') method does not.

Check out the results below

img = dlib.load_rgb_image("myimg.jpg")
print(img.shape)

--------------------
OUTPUT: (1944, 2592, 3)
(the resultant image is rotated 90 degrees clockwise)

while OpenCV's method returns the correct shape:

img = cv2.imread("myimg.jpg")
print(img.shape)

--------------------
OUTPUT: (2592, 1944, 3)

dlib.load_rgb_image() does not take into account the EXIF orientation metadata, so some images are read incorrectly.

I don't want to go in and rotate some of these offending images myself manually because I'm creating an app.

Is there a way in Dlib to read images using orientation information?

Note: I asked this question of stackoverflow, one of the comments told me to create an issue here

  • Version: 19.17.0
  • Where did you get dlib: pip
  • Platform: Windows 10 - 64bit
  • Compiler: python 3.6
@RafayAK
Copy link
Author

RafayAK commented Mar 29, 2019

Added platform info

@davisking
Copy link
Owner

davisking commented Mar 30, 2019

Yeah, it doesn't do anything with EXIF data. It would be cool if the loader used it. Someone should submit a pull request that adds that feature :)

@RafayAK
Copy link
Author

RafayAK commented Apr 1, 2019

I'll see what I can do.

@nmaynes
Copy link

nmaynes commented Apr 8, 2019

Would this require changes somewhere towards the top of image_loader.h?

@davisking
Copy link
Owner

That would be sensible.

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

3 participants