r.colors.contrastbrightness
Change the contrast/brightness of a raster.
r.colors.contrastbrightness input=name output=name minimum=value maximum=value contrast=value brightness=value [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.colors.contrastbrightness input=name output=name minimum=0.0 maximum=0.0 contrast=1.0 brightness=0.0
grass.script.run_command("r.colors.contrastbrightness", input, output, minimum, maximum, contrast=1.0, brightness=0.0, overwrite=None, verbose=None, quiet=None, superquiet=None)
Example:
gs.run_command("r.colors.contrastbrightness", input="name", output="name", minimum=0.0, maximum=0.0, contrast=1.0, brightness=0.0)
grass.tools.Tools.r_colors_contrastbrightness(input, output, minimum, maximum, contrast=1.0, brightness=0.0, overwrite=None, verbose=None, quiet=None, superquiet=None)
Example:
tools = Tools()
tools.r_colors_contrastbrightness(input="name", output="name", minimum=0.0, maximum=0.0, contrast=1.0, brightness=0.0)
This grass.tools API is experimental in version 8.5 and expected to be stable in version 8.6.
Parameters
input=name [required]
Raster map to change the contrast of.
output=name [required]
Name for output raster map
minimum=value [required]
Minimum input/output data value
maximum=value [required]
Maximum input/output data value
contrast=value [required]
Contrast (gain, 8bit=>[1.0-3.0]
Default: 1.0
brightness=value [required]
Brightness (bias, 8bit=>[0.0-100.0])
Default: 0.0
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
input : str, required
Raster map to change the contrast of.
Used as: input, raster, name
output : str, required
Name for output raster map
Used as: output, raster, name
minimum : float, required
Minimum input/output data value
Used as: value
maximum : float, required
Maximum input/output data value
Used as: value
contrast : float, required
Contrast (gain, 8bit=>[1.0-3.0]
Used as: value
Default: 1.0
brightness : float, required
Brightness (bias, 8bit=>[0.0-100.0])
Used as: value
Default: 0.0
overwrite : bool, optional
Allow output files to overwrite existing files
Default: None
verbose : bool, optional
Verbose module output
Default: None
quiet : bool, optional
Quiet module output
Default: None
superquiet : bool, optional
Very quiet module output
Default: None
input : str | np.ndarray, required
Raster map to change the contrast of.
Used as: input, raster, name
output : str | type(np.ndarray) | type(np.array) | type(gs.array.array), required
Name for output raster map
Used as: output, raster, name
minimum : float, required
Minimum input/output data value
Used as: value
maximum : float, required
Maximum input/output data value
Used as: value
contrast : float, required
Contrast (gain, 8bit=>[1.0-3.0]
Used as: value
Default: 1.0
brightness : float, required
Brightness (bias, 8bit=>[0.0-100.0])
Used as: value
Default: 0.0
overwrite : bool, optional
Allow output files to overwrite existing files
Default: None
verbose : bool, optional
Verbose module output
Default: None
quiet : bool, optional
Quiet module output
Default: None
superquiet : bool, optional
Very quiet module output
Default: None
Returns:
result : grass.tools.support.ToolResult | np.ndarray | tuple[np.ndarray] | None
If the tool produces text as standard output, a ToolResult object will be returned. Otherwise, None
will be returned. If an array type (e.g., np.ndarray) is used for one of the raster outputs, the result will be an array and will have the shape corresponding to the computational region. If an array type is used for more than one raster output, the result will be a tuple of arrays.
Raises:
grass.tools.ToolError: When the tool ended with an error.
DESCRIPTION
The r.colors.contrastbrightness module generates a contrasted version of the input raster map. The contrast is the gain of the affine transform, use values of 1.0-3.0 in case of an 8 bit image. The brightness is the bias of the affine transform, use values of 0.0-100.0 in case of an 8 bit image.
EXAMPLES
Contrast enhancement of an 8-bit raster band This does nothing to the image:
r.colors.contrastbrightness min=0.0 max=255.0 contrast=1.0 brightness=0.0 input=myinraster output=myoutraster
This does change the contrast of the image:
r.colors.contrastbrightness min=0.0 max=255.0 contrast=3.0 brightness=0.0 input=myinraster output=myoutraster
This does change the brightness of the image:
r.colors.contrastbrightness min=0.0 max=255.0 contrast=1.0 brightness=100.0 input=myinraster output=myoutraster
SEE ALSO
r.colors, v.colors, r3.colors, r.cpt2grass, r.colors.matplotlib
AUTHOR
Yann Chemin, JRC, Ispra, Italy
SOURCE CODE
Available at: r.colors.contrastbrightness source code
(history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819