ImageLevels

ImageLevels[image]

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

ImageLevels[image,bspec]

bins pixel values using bin specification bspec.

ImageLevels[image,bspec,range]

gives counts for bins in the given range.

Details and Options

  • ImageLevels gives access to the pixel count values typically used for color histogram analysis, such as understanding brightness, contrast and other color distributions.
  • 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}
    "XYZ"{{0,0.97},{0,1},{0,0.83}}
    "LAB"{{0,1},{-0.8,0.94},{-1.13,0.94}}
    "LCH"{{0,1},{0,1.3},{0,1}}
    "LUV"{{0,1},{-0.85,1.76},{-1.26,0.88}}
  • 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

Examples

open allclose all

Basic Examples  (3)

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

Levels of an RGB image:

Intensity levels of a 3D image:

Scope  (5)

Levels of a binary image:

Levels of an image in the range 0 to 255:

Levels for a random image that has intensity values outside the normal range from 0 to 1:

Explicit data range setting:

Tally of all levels in a random image:

Options  (1)

Method  (1)

By default, pixel values outside the normal range are included:

Exclude values outside the normal range:

Applications  (1)

Plot levels of a random image with a Laplacian distribution of pixel values:

Possible Issues  (1)

A tally of all levels in an image returns a result with non-uniform distribution of bins:

Wolfram Research (2010), ImageLevels, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageLevels.html (updated 2014).

Text

Wolfram Research (2010), ImageLevels, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageLevels.html (updated 2014).

CMS

Wolfram Language. 2010. "ImageLevels." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/ImageLevels.html.

APA

Wolfram Language. (2010). ImageLevels. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageLevels.html

BibTeX

@misc{reference.wolfram_2024_imagelevels, author="Wolfram Research", title="{ImageLevels}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/ImageLevels.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_imagelevels, organization={Wolfram Research}, title={ImageLevels}, year={2014}, url={https://reference.wolfram.com/language/ref/ImageLevels.html}, note=[Accessed: 22-November-2024 ]}