Skip to content

Commit

Permalink
Add i.colors.enhance algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Médéric RIBREUX committed May 29, 2016
1 parent 651302e commit 89ec2fb
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
@@ -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

48 changes: 48 additions & 0 deletions python/plugins/processing/algs/grass7/ext/i_colors_enhance.py
@@ -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.