2

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?

1 Answer 1

2

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.

2
  • Thank you!! I found an even shorter way around the problem. If you save the raster as a project, QGIS generates an .xml file in your working directory....lo and behold, that contains the full gdalinfo output, including counts per pixel value! Oct 19, 2014 at 21:05
  • adding to this: I found that if you save the raster layer as a GTFF (geotif) it'll generate the XML. I tried to save the raster as a project on its own and nothing happened.
    – dez93_2000
    May 17, 2016 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.