Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Adapting image.py to 16 bits gray #19

Closed
wants to merge 9 commits into from

Conversation

GuillaumeErhard
Copy link

Avoid needless downsampling of 16 bits gray image to 8 bits, and current clipping from Pillow is wrong, see :
python-pillow/Pillow#3011

Avoid needless downsampling of 16 bits gray image to 8 bits, and current clipping from Pillow is wrong, see :
python-pillow/Pillow#3011
@Dref360
Copy link
Contributor

Dref360 commented Jul 16, 2018

Please fix conflicts and add a test.

@matthewbundala
Copy link

@GuillaumeErhard , are you still working on this? I need to load 16-bit single channel tiff images, and ran into the exact issue you are trying to fix with image clipping.

@GuillaumeErhard
Copy link
Author

GuillaumeErhard commented Aug 1, 2018

@matthewbundala I am lacking the time right now to go further with these changes as right now it is affecting the process for 8 bits image. For example if you use the data augmentation of changing brightness the image is in a float32 bits state and it needs to be casted back to 8 / 16 bits, and it is impossible to access what you started you started with.

On top of that Pillow cannot resize an image with only one mode, nearest so all these limitations should be added in the documentation, but I don't know where and what are all the limitations of Pillow on 16 bits image.

What I think should be done is restarting from scratch in keras-contrib to reimplement all these functions using opencv for unconventional format like gray 16 bits, rgb 16 bits and so on, and keep it clean here with Pillow.

If you want to make it work never the less but loss some functionality, just change in your keras-preprocessing package the file image.py at the function load_img and change the check for gray image from img.mode != 'L' to image.mode not in ('L', 'I;16')

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants