concept histogram in category geoprocessing

appears as: histograms, histogram, The histogram
Geoprocessing with Python

This is an excerpt from Manning's book Geoprocessing with Python.

The easiest way to get a histogram is to use the GetHistogram function on a band. You can specify exactly what bins you want to use, but the default is to use 256 of them. The first one includes values between -0.5 and 0.5, the second bin goes from 0.5 to 1.5, and so on. So if you have byte data, this histogram will have one bin per possible pixel value (0, 1, 2, and so on). If no histogram data already exist for the raster, then this function computes an approximate one by default, but you can request an exact one. The function looks like this:

GetHistogram([min], [max], [buckets], [include_out_of_range], [approx_ok],
            [callback], [callback_data])
  • min is the minimum pixel value to include in the histogram. The default value is 0.5.
  • max is the maximum pixel value to include in the histogram. The default value is 255.5.