Automatic stretching of the raster histogram in QGIS
01.03.2011 15:01 · GIS · qgis, tips
QGIS allows you to save a default raster band combination, standard deviation and contrast enhancement algorithm for rasters.
But it seems that not many people use this feature. At least no one noticed that although the band combination and standard deviation can be saved, they are of no use because the saved values are not applied when the raster is loaded. There were also other problems (for example, when the default band combination is set to 5-4-3, in the raster properties dialogue we still see 1-2-3) that no one reported.
All this has been around for a long time, somewhere since r13582 or even earlier. And only in r15256 were all these problems finally solved.
I’ll try to explain why you might need it all this settings and how to use them.
As you know, the number of bands in raster data can often be more than three, e.g. Landsat imagery has 8 bands. When working with such rasters, the standard combination of bands 1-2-3 (band 1 — R, band 2 — G, band 3 — B) is not suitable, the image will be uninformative.
For this type of data, a 5-4-3 combination is usually used; it looks a little better, but the image is still quite dark.
By applying the “Stretch to MinMax” contrast enhancement algorithm, we get an image we can work with.
To further emphasise the different regions, we can also set the standard deviation to 2.
If you save all these settings as default, then all rasters of this type will be loaded with the correct display settings without any further user action. At the same time, rasters with 1 or 3 bands will be loaded as usual, without stretching and with a 1-2-3 band combination.
Read more about common Landsat band combinations here and here.