How many gray levels can Matlab show?

Say I have an Image of uint16 matrix.

Basically, each pixel can range from 0 to 65535 .

If I show this image using imshow(Image) How many gray levels will Matlab display?

Standard levels 255 (thus implicitly converting the image to uint8)?
(Please note that I know that I can change the color code, but I would like to know only the number of gray levels)

+4
source share
3 answers

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

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

Please note that most monitors only support 8 bits of gray. And depending on the quality and calibration of the display, you may see much less.

+7
source

This may be a more complicated answer. Most computers can ONLY display 256 shades of gray at the moment.

Matlap will NOT be able to do something better than this. However, using pseudo-coloring schemes, you can get Matlab to PRESENT the full 16 bits per pixel, in which case it will be displayed above the 65535 colors that you choose in your color scheme.

+5
source

I do not think any limit is respected by Matlab. RGB and HSV colors can also be doubled - this gives you an “almost infinite” number of colors (as well as gray).

Graphics windows are made in Java. There, the color can be determined by four floats (see Color ) - leaving you still with more colors than the hardware can handle.

Reference:

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

Thus, ultimately it depends on your equipment.

0
source

All Articles