Closed jimjam-slam closed 2 years ago
Thanks for writing the issue.
On RectLabel, each image is rotated and shown in the front orientation. So that the annotation file on RectLabel assumes that the image is rotated and shown in the front orientation. https://rectlabel.com/help#open_both_folders
To convert all images to the front orientation, please use Export menu -> Resize all images feature. Set "Image size max" empty, then images are saved in the front orientation with the same image size.
Let us know your opinion.
Hi there! Thanks for engaging so quickly. I gave the "Resize all images command" option a crack, but it doesn't seem to have had any material effect on the images' sizes.
In my case, it's not that some of the training images have been pre-rotated—rather, the images were taken nearly directly face down, and so my phone (which took the images) has chosen different orientations for them based on minor differences in camera orientation.
The images are all the same size, and they are all already "front orientation", but that's not actually a useful term for these pictures. I'd like to ensure that they're either all landscape or all portrait.
Hi,
We edited to the simple sentences.
Most image viewers automatically rotate the image to the front orientation according to its EXIF orientation flag. In the new update, RectLabel show the image name, width, height, and EXIF orientation flag at the top-left corner.
When you read the image using python module like pillow, it does not automatically rotate the image to the front orientation. So that the image size is different from the image size in the annotation file (.xml and .json).
Example images using each of the EXIF orientation flags (0-to-8) https://github.com/recurser/exif-orientation-examples
You can rotate the image by yourself according to its EXIF orientation flag or you can use Export menu -> "Resize all images" on RectLabel. Set "Image size max" empty, then all images are rotated to the front orientation and saved. EXIF orientation flag is removed from the jpg file.
Currently If you need our support to fix this problem, please let us know.
Best regards, Ryo
Thanks very much! I actually solved this on my end using an R script to isolate the images that were landscape, rotating them and then manually recomputing the feature coordinates in RectLabel's XML output. I don't actually know what the EXIF orientation tags in the images are in my images, but given your explanation of the way RectLabel's Resize All Images works and the fact that it didn't alter my images, I think it's likely they were all already front-oriented and it was just that the front in some of them was landscape and in others it was portrait.
Thanks again!
On Thu, 16 Sept 2021 at 11:18, Ryo Kawamura @.***> wrote:
When you use Export menu -> Resize all images feature, all image are overwritten using opencv methods imread() and imwrite(), then each image is rotated to the front orientation and the exif orientation tag is removed from the jpg file.
On RectLabel, as debugging, we can use NSImage -> initWithDataIgnoringOrientation() method not to rotate image automatically according to the exif orientation tag.
Before resizing, Portrait_6.jpg is shown in the landscape orientation and the annotation does not match.
[image: before_resizing] https://user-images.githubusercontent.com/1954306/133533183-12db1c9d-e114-467c-a092-5ea67bf7923c.png
After resizing, Portrait_6.jpg has no exif orientation tag so that the image is shown in the front orientation and the annotation matches.
[image: after_resizing] https://user-images.githubusercontent.com/1954306/133533192-89f66987-090d-4c18-952f-b3c7477fb9ac.png
We think Export menu -> Resize all images can convert all exif oriented images so that each image does not have any exif orientation tag and shown in the front orientation. When you train on python modules, the image size in the annotation file matches with the actual image size.
Let us know your opinion.
For skimage, we read the issue below and it looks that pillow is recommended.
skimage.io rotates the image scikit-image/scikit-image#3150 https://github.com/scikit-image/scikit-image/issues/3150
"Personally, I think this is better handled either down in Pillow, or in imageio. scikit-image having their own additional features for reading in images seems problematic."
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ryouchinsa/Rectlabel-support/issues/187#issuecomment-920500883, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRX6U3CCBMRGUESNYO3ED3UCFAVTANCNFSM5D7OVG2A .
Currently If you need our support to fix this problem, please let us know.
Hi there! Love using RectLabel. I've labelled a bunch of images, but it wasn't until I went to train my model that I realised the fact half the images are portrait and half are landscape might be problematic for the model (there isn't necessarily a natural orientation for the images themselves, so I didn't check at the time). It'd be great if RectLabel had the ability to rotate some of the images so that they were all portrait or all landscape (while transforming existing labels to their new coordinates in the rotated images)!