Skip to content

Commit 89ec2fb

Browse files
author
Médéric RIBREUX
committedMay 29, 2016
Add i.colors.enhance algorithm
1 parent 651302e commit 89ec2fb

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
 
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
i.colors.enhance
2+
Performs auto-balancing of colors for RGB images.
3+
Imagery (i.*)
4+
ParameterRaster|red|Name of red channel|False
5+
ParameterRaster|green|Name of green channel|False
6+
ParameterRaster|blue|Name of blue channel|False
7+
ParameterNumber|strength|Cropping intensity (upper brightness level)|0|100|98|True
8+
*ParameterBoolean|-f|Extend colors to full range of data on each channel|False
9+
*ParameterBoolean|-p|Preserve relative colors, adjust brightness only|False
10+
*ParameterBoolean|-r|Reset to standard color range|False
11+
*ParameterBoolean|-s|Process bands serially (default: run in parallel)|False
12+
OutputRaster|redoutput|Enhanced Red
13+
OutputRaster|greenoutput|Enhanced Green
14+
OutputRaster|blueoutput|Enhanced Blue
15+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
i_colors_enhance.py
6+
-------------------
7+
Date : March 2016
8+
Copyright : (C) 2016 by Médéric Ribreux
9+
Email : medspx at medspx dot fr
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = 'Médéric Ribreux'
21+
__date__ = 'March 2016'
22+
__copyright__ = '(C) 2016, Médéric Ribreux'
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
from i import exportInputRasters
29+
30+
31+
def processCommand(alg):
32+
33+
# Temporary remove outputs:
34+
outputs = [alg.getOutputFromName('{}output'.format(f)) for f in ['red', 'green', 'blue']]
35+
for out in outputs:
36+
alg.removeOutputFromName(out.name)
37+
38+
alg.processCommand()
39+
40+
# Re-add outputs
41+
for output in outputs:
42+
alg.addOutput(output)
43+
44+
45+
def processOutputs(alg):
46+
# Input rasters are output rasters
47+
rasterDic = {'red': 'redoutput', 'green': 'greenoutput', 'blue': 'blueoutput'}
48+
exportInputRasters(alg, rasterDic)

0 commit comments

Comments
 (0)
Please sign in to comment.