-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading 16-bit tiff images #5005
Conversation
/check |
❌ Some checks failed |
@MyNameIsFu , thanks for the contribution. Could you please add a line into CHANGELOG.md? |
I added a comment. Is there anything I have to change regarding the failed pipeline? |
/check |
🚫 Workflows has been canceled |
Hi, @MyNameIsFu, I checked your PR and met with problem: I can't create an issue with an image. This error is also the cause of the failure of the entire our testing pipeline. We can't merge PR until the entire test pipeline goes green. I attach the image to this comment, so you can reproduce this problem. |
@kirill-sizov The attached image seems to be cropped. Can you upload it again? |
@MyNameIsFu, I've uploaded the right image, this is a cropped small image that I have a problem with. |
Ah sorry, I'll debug it and push the changes 👍 |
@MyNameIsFu, I got the following error: And here is logs from |
Okay I looked into the Error, the CI Pipeline and the Tests and None of my changes should have any effect on the above error. I'm not even able to reproduce the Issue with CVAT. Nevertheless I tried to reproduce the Error without CVAT and instead with pure PIL and it appears to be a problem with implicit image conversion from RGBA to RGB (PNG to JPEG format). I'll take another look at the error and why it might differently behave on the Pipeline and my System. I also pushed Pillow version 9.2.0, just out of curiousity. |
/check |
❌ Some checks failed |
@MyNameIsFu , thanks for the contribution once again. If tests are OK, I will merge the PR. In general I hope to reimplement the solution in the future. Actually we need to have 16-bit image in UI to change contract and brightness dynamically. Even it sounds simple, the actual implementation is going to be non-trivial. |
# Issue was opened 2018, so don't expect any changes soon and work with manual conversions. | ||
mode: str = preview.mode | ||
if mode == "I;16": | ||
preview = np.array(preview, dtype=np.uint16) # 'I;16' := Unsigned Integer 16, Grayscale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to have a function to avoid code duplication.
Pull Request regarding Issue cvat-ai#2987 PIL.Image conversion from I;16 to L or RGB are unsuccessful as for now. See the corresponding Issue in the Pillow GitHub (Opened 2018, so no changes to be expected) python-pillow/Pillow#3011 The proposed changes at least fix this issue for the mode 'I;16' and delivers a possible solution for other modes (eg. I;16B/L/N). This results in a correct calculation of the preview thumbnail and the actual image, the annotation will be performed on. We have used this solution on our own dataset and created annotations accordingly.
Pull Request regarding Issue #2987
PIL.Image conversion from I;16 to L or RGB are unsuccessful as for now.
See the corresponding Issue in the Pillow GitHub (Opened 2018, so no changes to be expected)
python-pillow/Pillow#3011
The proposed changes at least fix this issue for the mode 'I;16' and delivers a possible solution for other modes (eg. I;16B/L/N).
This results in a correct calculation of the preview thumbnail and the actual image, the annotation will be performed on.
We have used this solution on our own dataset and created annotations accordingly.
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.