-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: Image scaling for large dynamic range ints #10133
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
Conversation
Yeah, understood. This is the dumbest solution. I don't quite understand why this rescaling is necessary, despite the nice comments.... |
OK, I only used the bigger float64 if the amin-amax > 1e8. |
I think(?) you probably care more about maxabs/minabs. |
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: matplotlib/lib/matplotlib/image.py Lines 389 to 390 in 884060a
and the resulting float doesn't preserve all the bits in the |
This is a reasonable approach. The scaling is to be able to track the over/under pixels and get around ringing in the interpolations. |
Discussed this on the phone call. Will investigate
|
5415e6a
to
9ba75dc
Compare
Test added, and changes requested above made... Thanks! |
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.
Working and slow is better than broken and fast. Happy to merge a future PR that keeps things working and makes it faster.
Backport PR #10133 on branch v2.1.x
PR Summary
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:
PR Checklist