The following code should be self explanatory, but floating point values should have a range in (0, 1)
, and integer type have their full range mapped to (0, 1)
(for unsigned types) or (-1, 1)
(for signed types):
>>> from numpy import int32
>>> skimage.color.rgb2xyz((rgb / 255 * (2**31 - 1)).astype(int32))
array([[[ 0.08590003, 0.08097913, 0.2293394 ],
[ 0.46907236, 0.3082294 , 0.09272133]]])
>>> skimage.color.rgb2xyz(rgb.astype(uint8))
array([[[ 0.08590003, 0.08097913, 0.2293394 ],
[ 0.46907236, 0.3082294 , 0.09272133]]])
>>> skimage.color.rgb2xyz(rgb.astype(float) / 255)
array([[[ 0.08590003, 0.08097913, 0.2293394 ],
[ 0.46907236, 0.3082294 , 0.09272133]]])