# Levels in an image

19 views (last 30 days)
Marium Malik on 31 Aug 2012
What does it mean by the maximum number of levels in an image?

Kevin Moerman on 31 Aug 2012
Not sure if I understand your question correctly but in some image formats the image data has a fixed amount of possible intensities. For instance an image may be defined as uint8 (unsigned integer 8-bit) which means that each pixel can have a value (intensity) between 0-255, and each intensity is a whole number (integer) in that range. So that gives 256 possible intensity levels (if that is what you mean). Another way to interpret your question would be layers. An RGB (red green blue) type image uses three layers to define colour (a single layer would define a large-scale image, some image types contain more than 3 layers). For each pixel 3 intensity levels, 1 for each colour, are defined and together (using a kind of mixing of the colours) they define the colour of that pixels. For an 8-bit RGB image you'd have 256 possible red, green and blue values to combine so that limits the maximum amount of colours that this image type can define.
Kevin

Image Analyst on 31 Aug 2012
This will work for uint images:
numberOfPossibleGrayLevels = int32(intmax(class(grayImage)))+1
For floating point images, there is no max number of intensity levels for all practical purposes.