Unexpected precision loss through conversion to half-float when writing an image. #34
Replies: 2 comments 5 replies
-
@ahemberger sounds like you might be outputting the normalized HDRI as 16bit half? You'd get inf on any value over 65,536. If you have Open Image IO run this to check values and dtype of the saved image. I'm guessing the dtype you're referencing is the internal dtype used in colour-hdri.
|
Beta Was this translation helpful? Give feedback.
-
Thank you for offering me a much better way of confirming this than trying to find out useful information about this image using Nuke/Natron/Photoshop on a macbook M1 max! (spoiler alert: none of those tools were helpful for this). oiiotool reports that the output image is half float, while the input image is float. The docs suggest that one option I have could be specifying my output image thusly: write_image(out, path, bit_depth='float64') # (docs say the default is 'float32') but this doesn't actually seem to work:
I would love to better understand what's actually going on here. |
Beta Was this translation helpful? Give feedback.
-
Hi;
I'm trying to use colour-science to shift the values of some HDR images generated with ptgui to a range that's easily-viewable. I notice when I do this, though, that there seems to be a pretty big data loss in transit; my input files are on the order if 280MB, whereas my output files are around 85MB.
Here is what I'm doing:
When I print the
dtype
of both images, the output says "float32". The images contain the sun on a bright clear day; the smaller output images have "inf" values in the core of the sun when I inspect the images in Nuke, whereas the original images have values that vary through the sun's core.It feels as though I'm losing data, though the dtype parity seems to disprove this...unless I'm mistaken about what ptgui calls a float32 image and what colour/numpy calls a float32 image?
Might anyone have clues to offer?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions