Re: Asymmetric behavior in dtype conversion
21 Dec
2011
21 Dec
'11
11:41 a.m.
On Wed, Dec 21, 2011 at 1:30 AM, Tony Yu <tsyu80@gmail.com> wrote:
I think one of two things should happen:
1) [uint -> int]: expand uint to *full* range of int. [int -> uint]: unchanged (squeeze into range of uint)
2) [uint -> int]: unchanged (fill *positive* range of int) [int -> uint]: clip negative values from int
People very often represent images in signed integers, even though they only manipulate positive values, e.g. storing 0-255 in int8. So the conversion to signed should not spread those values over the entire range. However, I think you're right that we should add the clipping in 2 to avoid the conversion bias, along with a nice big warning. Regards Stéfan
4761
Age (days ago)
4761
Last active (days ago)
0 comments
1 participants
participants (1)
-
Stéfan van der Walt