Skip to content
Permalink
Browse files

Add i.colors.enhance algorithm

  • Loading branch information
Médéric RIBREUX
Médéric RIBREUX committed Apr 24, 2016
1 parent 651302e commit 89ec2fbb7cdc2fbb431abbe4c17c13a7488f86e6
@@ -0,0 +1,15 @@
i.colors.enhance
Performs auto-balancing of colors for RGB images.
Imagery (i.*)
ParameterRaster|red|Name of red channel|False
ParameterRaster|green|Name of green channel|False
ParameterRaster|blue|Name of blue channel|False
ParameterNumber|strength|Cropping intensity (upper brightness level)|0|100|98|True
*ParameterBoolean|-f|Extend colors to full range of data on each channel|False
*ParameterBoolean|-p|Preserve relative colors, adjust brightness only|False
*ParameterBoolean|-r|Reset to standard color range|False
*ParameterBoolean|-s|Process bands serially (default: run in parallel)|False
OutputRaster|redoutput|Enhanced Red
OutputRaster|greenoutput|Enhanced Green
OutputRaster|blueoutput|Enhanced Blue

@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
i_colors_enhance.py
-------------------
Date : March 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Médéric Ribreux'
__date__ = 'March 2016'
__copyright__ = '(C) 2016, Médéric Ribreux'

# This will get replaced with a git SHA1 when you do a git archive

__revision__ = '$Format:%H$'

from i import exportInputRasters


def processCommand(alg):

# Temporary remove outputs:
outputs = [alg.getOutputFromName('{}output'.format(f)) for f in ['red', 'green', 'blue']]
for out in outputs:
alg.removeOutputFromName(out.name)

alg.processCommand()

# Re-add outputs
for output in outputs:
alg.addOutput(output)


def processOutputs(alg):
# Input rasters are output rasters
rasterDic = {'red': 'redoutput', 'green': 'greenoutput', 'blue': 'blueoutput'}
exportInputRasters(alg, rasterDic)

0 comments on commit 89ec2fb

Please sign in to comment.
You can’t perform that action at this time.