dynamic
dynamic

Reputation: 48131

How many gray levels Matlab can show?

Let's say I have a Matrix Image of uint16.

Where basically each pixel can range from 0 to 65535.

If I display this image with imshow(Image) How many levels of gray Matlab will render?

The standard 255 levels (thus implicitly converting the image to uint8)?
(Please note I know I can change the colormap, but I would like to know only the number of gray levels )

Upvotes: 5

Views: 2048

Answers (3)

trumpetlicks
trumpetlicks

Reputation: 7065

This can be a more complex answer than that. Most computers can ONLY DISPLAY 256 shades of gray currently.

MATLAB is NOT going to be able to do any better than that. However, using pseudo-coloring schemes, you may be able to get MATLAB to REPRESENT the full 16 bits per pixel in which case it will be displaying upwards of the 65535 colors you choose in your color scale.

Upvotes: 5

bdecaf
bdecaf

Reputation: 4732

i don't think any limit is enforced by Matlab. RGB and HSV color values can also be doubles - giving you a "near infinite" number of colors (and also grays).

The plot windows are done in Java. There the color can be defined by four floats (see Color) - leaving you still with a more colors than hardware can handle.

Help states:

The actual color used in rendering depends on finding the best match given the color space available for a particular output device.

So in the end it seems to depend on your hardware.

Upvotes: 0

shoelzer
shoelzer

Reputation: 10708

The size of the colormap tells you how many colors (or gray levels, in this case) Matlab is trying to display.

numGrayLevels = size(get(gcf,'Colormap'),1)

Note that most monitors only support 8-bits of gray. And depending on the quality and calibration of the display you may be seeing far less than that.

Upvotes: 7

Related Questions