[gdal-dev] Statistics min/max results are differents from histogram min/max results

Even Rouault even.rouault at spatialys.com
Wed Sep 2 11:24:06 PDT 2015


Le mercredi 02 septembre 2015 20:08:47, Andrea Peri a écrit :
> Hi,
> 
> I see the minimum and maximum retrieved using the gdalinfo -stas comand
> are quite different from the same minimum and maximum retireved using
> the API python function "GetDefaultHistogram" ?

Andrea,

The min and max values returned by GetDefaultHistogram() aren't necessarily 
the min and max values of the pixel values of the raster, but of the selected 
bounds for the buckets of the histogram.

 * @param pdfMin pointer to double value that will contain the lower bound of 
the histogram.
 * @param pdfMax pointer to double value that will contain the upper bound of 
the histogram.

In the case of a Byte raster, those bounds are hardcoded to be -0.5 and 255.5. 
This is a speed optimization, as in the general case, for other datatypes, the 
actual min & max values from statistics will be first computed, and then the 
histogram.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list