[Bug] Patches truncated for 16 bit images
See original GitHub issueLikely due to this line: https://github.com/neuropoly/axondeepseg/blob/57047da51781c12d06c1b5d59dcb705bf4adc376/AxonDeepSeg/data_management/dataset_building.py#L44
Combining preserve_range
plus asint
may be what’s truncating the patches (all white).
The solution may be as simple as removing the asint
call.
@maxwab you wrote that line; do you see any issues with removing the asint
call? I’ll double check the rest of the code to make sure it’s not assumed to be an 8bit int anywhere else. I guess it means that if I remove this, the data size will be much larger… Otherwise, removing the perserve_range could also possibly be a solution.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
[Bug] Patches truncated for 16 bit images · Issue #166 - GitHub
Poking around, although I was able to find where the images are converted toint patches in the dataset building stage, but in the...
Read more >Large images may cause "Image corrupt or truncated" error
Examples of appropriate bugs: PNG gAMA chunk ignored; Crashes on GIF w/corrupted frame(merr-01.gif); or PNGs and JPEGs aren't displayed on FreeBSD.
Read more >Google patches actively exploited zero-day bug that affects Chrome ...
1) Obtains the image width and height from the header as 32-bit integers. 2) Truncates the obtained values to 16 bit and stores...
Read more >Bug 645938 – image exported to .png is truncated
I tested with 16M rows, 1000 pixels high each, and I did not see any resolution loss. I did not read all cairo...
Read more >macOS Image Capture Bug More Pervasive Than Originally ...
Earlier this week we reported on a bug in Apple's macOS Image Capture app that adds empty data to photos when imported from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @mathieuboudreau, At first glance I don’t see any problem with removing the
.astype(int)
call. The most likely reason I added this call at the time was to ensure the type ofimg
. As far as I can tell, the reason was not memory usage.It may also be the “L” mode: https://github.com/python-pillow/Pillow/issues/3011
L mode is 8bit pixel (black and white): https://docs.scipy.org/doc/scipy/reference/generated/scipy.misc.imread.html