davisking/dlib

Support for reading images in correct orientation using EXIF data.

开放

#1,706 创建于 2019年3月28日

 (5 条评论) (1 个反应) (0 位负责人)C++ (3,442 个派生)batch import
enhancementhelp wanted

仓库指标

星标
 (14,434 个星标)
PR 合并指标
 (平均合并 3小时 56分钟) (30 天内合并 2 个 PR)

描述

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

贡献者指南