[GIS] How to extract the data behind a raster histogram

ecwqgis

Bit of a newbie, so this may be a daft question.

I have an .ecw picture – it is has no CRS, as it is a picture taken at ground level with an NIR camera. It was originally converted from a RAW image.

I can load it as a raster image, and generate a histogram. However, I would like to interrogate the data behind the histogram. For example, I might want to take peak height (easy), average, median, max, or min or use a calculation that looks at data spread.

All I can find suggests you use the -c flag in GRASS's r.report (e.g. How to extract pixel value counts from a raster in QGIS?'ve kept the flags the same as this example (apart from the selected image, that is!)

However, when I use it, I keep getting a 'Raster Map Not Found' error. Just trying it with a .tiff map image (which has a CRS), I get the same problem.

Am I missing something blindingly obvious?

Best Answer

You are selecting your image in the tool dialogbox (not just in the layer TOC? I ask because, unlike other Grass tools, it is not quite so obvious.

Alternatively you could use gdalinfo. You get to this tool via Raster->Miscellaneous->Information. Select your raster and then click the little yellow pencil to edit the gdalinfo commandline options. It looks like you will want to add at least '-stats' or maybe '-hist' and possibly some other options.

Check the documentation for this tool to see all the available options. For some reason this tool seems awfully slow in QGIS but happily, if you should have a version of it in your /osgeo4w/bin folder (or equivalent for Linux users) and can run it from the command line.