1

I read the following in the documentation of im2double

Class Support:

Intensity and truecolor images can be uint8, uint16, double, logical, single**, or int16. Indexed images can be uint8, uint16, double or logical. Binary input images must be logical. The output image is double

I am working on a 64 bit machine (i.e. MATLAB uses 8 bytes to represent variables of type double). I have an indexed image of type uint32 and I believe I should be able to convert it to type double, but im2double doesn't seem to support it, i.e. I get the following error:

Error using im2double Expected input number 1, Image, to be one of these types:

double, logical, uint8, uint16, int16, single

Instead its type was uint32.

So, how can I convert a matrix (an indexed image) of type uint32 to double?

This is all on MATLAB 2012a

Amro
  • 123,847
  • 25
  • 243
  • 454
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564

1 Answers1

1

According to this page (some info here as well):

Indexed (Also known as a pseudocolor image)

Array of class logical, uint8, uint16, single, or double whose pixel values are direct indices into a colormap. The colormap is an m-by-3 array of class double.

For single or double arrays, integer values range from [1, p]. For logical, uint8, or uint16 arrays, values range from [0, p-1].

therefore MATLAB does not support indexed images of class uint32. I guess you'll have to do some sort of color quantization.

Amro
  • 123,847
  • 25
  • 243
  • 454
  • 1
    Another good reference: [Displaying Bit-Mapped Images](http://www.mathworks.com/help/techdoc/creating_plots/f2-1233.html) – Amro Jul 29 '12 at 23:36