Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
FIX: Image scaling for large dynamic range ints #10133
This fixes #10072.
The problem was that for a uint32 image, the dynamic range was too high for a float32 to properly represent. Simply changing to float64 fixes the issue. I suppose someone could use a unit64 image, but...
Test coming: code:
import matplotlib.pyplot as plt import numpy as np img = np.load('/Users/jklymak/downloads/test_image.npy') img = np.array([[1, 2, 3], [1, 2, 10000000000]], dtype=np.uint32) #Display full image plt.imshow(img, interpolation = 'nearest') plt.clim(0, 5.) plt.show()
Hmmm, not at all sure, because I once understood all the low-level reps of floats etc, but not so good at it anymore. Happy if someone wants to pick this up and do it better.
But, I think the error comes in when we do:
and the resulting float doesn't preserve all the bits in the