Implement Decorrelation Stretching for the display of color composites

Issue #450 resolved
Agustin Lobo created an issue

I suggest implementing Decorrelation stretching for the display of color composites, an old but yet very useful method. Very popular among Envi users.

Perhaps it would be best implemented in the QGIS rastr display properties.

References

http://dhanushkadangampola.blogspot.com/2015/02/decorrelation-stretching.html

Gillespie, A. R., Kahle, A. B., and Walker, R. E. (1986), Color enhancement of highly correlated images. I. Decorrelation and HSI contrast stretches, Remote Sensing of Environment, 20:209-235
http://www.sciencedirect.com/science/article/pii/0034425786900441

[1]D. A. ROTHERY, “Cover Decorrelation stretching as an aid to image interpretation,” International Journal of Remote Sensing, vol. 8, no. 9, pp. 1253–1254, Sep. 1987, doi: 10.1080/01431168708954771.
https://doi.org/10.1080/01431168708954771

[1]D. A. ROTHERY and G. A. HUNT, “Technical note A simple way to perform decorrelation stretching and related techniques on menu-driven image processing systems,” International Journal of Remote Sensing, vol. 11, no. 1, pp. 133–137, Jan. 1990, doi: 10.1080/01431169008955005.

Official response

Comments (13)

  1. Agustin Lobo reporter

    I think that, as an enhanced visualization technique, the original method involves the PCA of the 3 bands selected for the color composite, stretching in PC space, inverse and color composite. An also interesting technique, but different, would be calculating all PCs, stretching in PC space, then inverse and select the bands for the color composite.

  2. Agustin Lobo reporter

    Great! I would perhaps modify the definition to “This algorithm applies decorrelation stretching (aka detrended stretching) to 3 selected bands for enhanced display as a trichromatic composite”.

  3. Agustin Lobo reporter
    1. It took me a while finding this tool in the Processing Toolbox within Post-processing. It is a visualization tool.
    2. Why does the result go to the “raw QGIS” window instead to the Enmapbox window?
    3. In principle, this tool is just for visualization, no need to create a new raster. It is just an enhancement.

    Using 3.9.20210926T092955.develop

  4. Andreas Janz

    Hi Agus, thanks for your feedback.

    It took me a while finding this tool in the Processing Toolbox within Post-processing. It is a visualization tool.

    Will put it under a new “Visualization” group.

    Why does the result go to the “raw QGIS” window instead to the Enmapbox window?

    In the current dev-version, the result is opened in both, QGIS and EnMAP-Box. This affects other algorithms as well. Ideally, it would only show up in the EnMAP-Box. I’ll create a new ticket for that issue.

    In principle, this tool is just for visualization, no need to create a new raster. It is just an enhancement.

    Agreed, it should only be a visualization! Currently, it is done like in ENVI: https://www.l3harrisgeospatial.com/docs/decorrelationstretch.html

    Ideally, it would be a new raster renderer integrated here:

    Unfortunately, that is not possible in the current QGIS. I had that problem recently, when implementing a renderer for visualising class fraction/probability raster. Here I decided to locate the functionality in the DataViews context menu:

    The same could be done for “Decorrelation Stretch Rendering” 🙂. I’ll create a new ticket for that!

  5. Agustin Lobo reporter

    When I try (3.10.20220119T091443.develop), I get:

    2022-02-01T18:04:24     WARNING    Traceback (most recent call last):
                  File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/gui/dataviews/dockmanager.py", line 1539, in
                  action.triggered.connect(lambda: self.showDecorrelationStretchRendererDialog(lyr, canvas))
                  File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/gui/dataviews/dockmanager.py", line 1632, in showDecorrelationStretchRendererDialog
                  widget = DecorrelationStretchRendererWidget(layer, canvas, parent=self.mDockTreeView)
                  File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages/typeguard/__init__.py", line 903, in wrapper
                  retval = func(*args, **kwargs)
                  File "/home/alobo/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxplugins/decorrelationstretchrenderer.py", line 128, in __init__
                  self.mRed.setLayer(1)
                 TypeError: QgsRasterBandComboBox.setLayer(): argument 1 has unexpected type 'int'

    It happens if I have not “Multiband color” previously selected in Layer Properties/Band Rendering. It should be possible to

    resolve this inconsistency just by selecting the bands in the DCS panel.

  6. Log in to comment