Add i.colors.enhance algorithm

This commit is contained in:
Médéric RIBREUX 2016-04-24 12:42:13 +02:00
parent 651302e360
commit 89ec2fbb7c
2 changed files with 63 additions and 0 deletions

View File

@ -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

View File

@ -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)