简体   繁体   English

为什么 cv2.imread 和 plt.imread 读取的一些照片的视图不同?

[英]Why the view of some photos read by cv2.imread and plt.imread are different?

I have some photos taken by UAV, and I find that the view of some photos read by cv2.imread and plt.imread are different, one of them is upside down (180° rotation), but most photos are the same.我有一些无人机拍摄的照片,我发现 cv2.imread 和 plt.imread 读取的一些照片的视图不同,其中一张是颠倒的(180°旋转),但大多数照片是相同的。

Why?为什么?

Unlike matplotlib (PIL), opencv takes EXIF information into account by default, see documentation :与 matplotlib (PIL) 不同,opencv 默认考虑 EXIF 信息,请参阅文档

If EXIF information is embedded in the image file, the EXIF orientation will be taken into account and thus the image will be rotated accordingly except if the flags IMREAD_IGNORE_ORIENTATION or IMREAD_UNCHANGED are passed.如果图像文件中嵌入了 EXIF 信息,则将考虑 EXIF 方向,因此图像将相应地旋转,除非传递了标志 IMREAD_IGNORE_ORIENTATION 或 IMREAD_UNCHANGED。

(to achieve the same with PIL, use exif_transpose ) (要使用 PIL 实现相同的功能,请使用exif_transpose

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM