I'm trying to read colormap of an image using this code:
[X, map] = imread('D:\Eye.png');
But map
is rescaled to [0,1]
type double
. How can I get the colormap in uint8
range [0,255]
?
I'm trying to read colormap of an image using this code:
[X, map] = imread('D:\Eye.png');
But map
is rescaled to [0,1]
type double
. How can I get the colormap in uint8
range [0,255]
?
This can be solved by simply rescaling
map
and casting it touint8
:Optionally, you can round it before casting (the default rounding scheme, as above, is
floor
):