davisking / davisking/dlib

Support for reading images in correct orientation using EXIF data.

Open
#1,706 5 comments 1 reaction 0 assignees View on GitHub
enhancement help wanted
Dominant language
C++
Stars
14.4k
Forks
3.4k
PR merge metrics
No merged PRs in 30d

Description

## 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](https://stackoverflow.com/questions/55392646/why-is-dlibs-load-rgb-image-method-rotating-some-of-my-images/55393992#55393992), 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.