Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#4750 closed defect (fixed)

Histogram calculation should ignore no data values

Reported by: Sam Gillingham Owned by: warmerdam
Priority: normal Milestone: 1.11.0
Component: GDAL_Raster Version: 1.9.1
Severity: normal Keywords: histogram nodata
Cc:

Description

Currently GDALRasterBand::ComputeStatistics ignores no data values but GDALRasterBand::GetHistogram does not. This is inconsistent and confusing. It impacts applications that estimate median/mode etc from the histogram. Attached proposed patch uses the same mechanism as ComputeStatistics to ignore no data values.

Attachments (2)

gdalrasterband.cpp.histignore.1.9.1.patch (1.2 KB ) - added by Sam Gillingham 12 years ago.
Patch for GetHistogram that ignores no data values
gdalrasterband.cpp.patch (1.2 KB ) - added by Sam Gillingham 11 years ago.
Patch for GetHistogram that ignores no data values. Updated against trunk

Download all attachments as: .zip

Change History (6)

by Sam Gillingham, 12 years ago

Patch for GetHistogram that ignores no data values

comment:1 by Satri, 11 years ago

I confirm that this patch by gillins seems to work fine for us. Thanks!

by Sam Gillingham, 11 years ago

Attachment: gdalrasterband.cpp.patch added

Patch for GetHistogram that ignores no data values. Updated against trunk

comment:2 by Sam Gillingham, 11 years ago

Just updated this patch against trunk. Any chance this could be included in GDAL 2.0? Seems this might be a suitable time to fix this inconsistency with ComputeStatistics()...

comment:3 by Even Rouault, 11 years ago

Milestone: 2.0
Resolution: fixed
Status: newclosed

Committed in trunk in r26192. Thanks

comment:4 by Even Rouault, 10 years ago

Milestone: 2.01.11.0
Note: See TracTickets for help on using tickets.