Opened 5 years ago

Closed 4 years ago

Last modified 3 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 5 years ago.
Patch for GetHistogram? that ignores no data values
gdalrasterband.cpp.patch (1.2 KB) - added by Sam Gillingham 4 years ago.
Patch for GetHistogram? that ignores no data values. Updated against trunk

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by Sam Gillingham

Patch for GetHistogram? that ignores no data values

comment:1 Changed 4 years ago by Satri

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

Changed 4 years ago by Sam Gillingham

Attachment: gdalrasterband.cpp.patch added

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

comment:2 Changed 4 years ago by Sam Gillingham

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 Changed 4 years ago by Even Rouault

Milestone: 2.0
Resolution: fixed
Status: newclosed

Committed in trunk in r26192. Thanks

comment:4 Changed 3 years ago by Even Rouault

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