gives a list of pixel values and counts for each channel in image.


bins pixel values using bin specification bspec.


gives counts for bins in the given range.

Details and Options

  • ImageLevels returns a list of levels for each channel in the form {{lev1,k1},{lev2,k2},}, where ki counts the values satisfying , except for the last bin, which uses .
  • Binary images have the form {{0,n0},{1,n1}}.
  • ImageLevels works with arbitrary grayscale and multichannel 2D and 3D images.
  • The binning specification bspec, which by default uses 256 levels, can be any of the following:
  • nn equally spaced bins
    Automaticautomatic choice of binning
    Allreturn tally of all available pixel values
    "Byte"256 levels after converting data values to a "Byte" type
  • The range can be of the following forms:
  • Automaticautomatic ranges depending on the color space
    Allinclude all values for each channel
    {All,max}include values below max
    {min,All}include values above min
    {min,max}include values between min and max
    {range1,}different ranges for each channel
  • The following defaults are used for range, depending on the image color space. The ranges are chosen to include the subspace of the "RGB" color space.
  • "Grayscale","RGB","CMYK","HSB"{0,1}
  • The following options can be specified:
  • Method"IncludeOutOfRange"method to use
  • Possible settings for Method include:
  • "IncludeOutOfRange"values below range in first bin and values above range in last bin
    "ExcludeOutOfRange"do not count out-of-range values


open allclose all

Basic Examples  (3)

Count the number of pixels in each of 10 intensity levels:

Click for copyable input

Levels of an RGB image:

Click for copyable input

Intensity levels of a 3D image:

Click for copyable input

Scope  (5)

Options  (1)

Applications  (1)

Possible Issues  (1)

See Also

ImageHistogram  ImageAdjust  ColorQuantize  Binarize  ImageData  HistogramList  BinCounts  Tally


Introduced in 2010
| Updated in 2014