Histogram - Maple Help

ImageTools

 Histogram
 compute a histogram for each layer of an image

 Calling Sequence Histogram( img, buckets, opts )

Parameters

 img - Image; input image buckets - (optional) posint; number of buckets/bins in the histogram (per layer) opts - (optional) equation(s) of the form option = value; specify options for the Histogram command

Options

 • autorange = truefalse
 If true, set the range to the minimum and maximum values that occur in the image (on all layers).  Overrides the range option. The default is false.
 • centers = truefalse
 If true, return two elements: the Vector (or Matrix) corresponding to the histogram, and a Vector corresponding to the center value of each bucket in the histogram. The default is false.
 • cumulative = truefalse
 Specifies that the count in each bucket is to include the counts in all the lower numbered buckets.  This is especially useful in conjunction with the normalized option causing each bucket to end up containing a value indicating which fraction of the pixels in the image were less than or equal to the upper bound of the bucket. By selecting an appropriate number of buckets (4, 5, 100), the values correspond to concepts like quartiles, quintiles, and percentiles. The default is false.
 • normalized = truefalse
 If true, the value in each bucket of each layer is scaled so that the sum of the values in the buckets in a layer is 1.0. The default is false.
 • range = numeric .. numeric
 Assigns the range of values that the buckets cover. The default is 0.0 .. 1.0, which corresponds to the range of values in an unprocessed image.

Description

 • The Histogram command computes a histogram of the intensity of each layer of an image, and returns a Vector (for one-layer images) or Matrix (for multi-layer images) containing the histogram information.
 • The img parameter specifies the image.
 • The optional buckets parameter specifies the number of buckets per color channel desired. For most images, which were originally read from 8-bit per channel image files, the default of 256 is a suitable value.
 • For a single layer (grayscale) image, the Histogram command returns a column Vector with buckets elements. For multi-layer images, a buckets x N Matrix is returned, where N is the number of layers.

Examples

 > $\mathrm{with}\left(\mathrm{ImageTools}\right):$

Create a grayscale image with intensity varying from 1/4 to 3/4.

 > $\mathrm{img}≔\mathrm{Create}\left(100,200,\left(r,c\right)↦\mathrm{evalf}\left(\frac{1}{2}+\frac{\mathrm{sin}\left(\frac{\mathrm{\pi }\cdot r}{50}\right)}{8}+\frac{\mathrm{cos}\left(\frac{\mathrm{\pi }\cdot c}{100}\right)}{8}\right)\right):$
 > $\mathrm{Histogram}\left(\mathrm{img},10\right)$
 $\left[\begin{array}{c}{0.}\\ {0.}\\ {1339.}\\ {3278.}\\ {5324.}\\ {5442.}\\ {3278.}\\ {1339.}\\ {0.}\\ {0.}\end{array}\right]$ (1)
 > $\mathrm{Histogram}\left(\mathrm{img},10,\mathrm{autorange},\mathrm{centers}\right)$
 $\left[\begin{array}{c}{1339.}\\ {1510.}\\ {1768.}\\ {2146.}\\ {3178.}\\ {3296.}\\ {2146.}\\ {1768.}\\ {1510.}\\ {1339.}\end{array}\right]{,}\left[\begin{array}{c}{0.275000000000000}\\ {0.325000000000000}\\ {0.375000000000000}\\ {0.425000000000000}\\ {0.475000000000000}\\ {0.525000000000000}\\ {0.575000000000000}\\ {0.625000000000000}\\ {0.675000000000000}\\ {0.725000000000000}\end{array}\right]$ (2)
 > $\mathrm{Histogram}\left(\mathrm{img},10,\mathrm{range}=0..0.5,\mathrm{centers}\right)$
 $\left[\begin{array}{c}{0.}\\ {0.}\\ {0.}\\ {0.}\\ {0.}\\ {1339.}\\ {1510.}\\ {1768.}\\ {2146.}\\ {13237.}\end{array}\right]{,}\left[\begin{array}{c}{0.0250000000000000}\\ {0.0750000000000000}\\ {0.125000000000000}\\ {0.175000000000000}\\ {0.225000000000000}\\ {0.275000000000000}\\ {0.325000000000000}\\ {0.375000000000000}\\ {0.425000000000000}\\ {0.475000000000000}\end{array}\right]$ (3)
 > $\mathrm{Histogram}\left(\mathrm{img},10,\mathrm{range}=0..0.5,\mathrm{normalized}\right)$
 $\left[\begin{array}{c}{0.}\\ {0.}\\ {0.}\\ {0.}\\ {0.}\\ {0.0669500000000000}\\ {0.0755000000000000}\\ {0.0884000000000000}\\ {0.107300000000000}\\ {0.661850000000000}\end{array}\right]$ (4)