test that image with exif orientation can be read
@@ -151,6 +151,14 @@ class TestTransformAnnotations(unittest.TestCase):
self.assertEqual(sem_seg.max(), 32)
self.assertEqual(sem_seg.min(), 1)
+ def test_read_exif_orientation(self):
+ # https://github.com/recurser/exif-orientation-examples/raw/master/Landscape_5.jpg
+ URL = "detectron2://assets/Landscape_5.jpg"
+ img = detection_utils.read_image(URL, "RGB")
+ self.assertEqual(img.ndim, 3)
+ self.assertEqual(img.dtype, np.uint8)
+ self.assertEqual(img.shape, (1200, 1800, 3)) # check that shape is not transposed
+
if __name__ == "__main__":
unittest.main()
