mosaic_to_rgb {pliman}R Documentation

Mosaic to RGB

Description

Convert an SpatRaster to a three-band RGB image of class Image.

Usage

mosaic_to_rgb(mosaic, r = 3, g = 2, b = 1, coef = 0, plot = TRUE)

Arguments

mosaic

A mosaic of class SpatRaster, generally imported with mosaic_input().

r

The layer for the Red band (default: 3).

g

The layer for the Green band (default: 2).

b

The layer for the Blue band (default: 1).

coef

An addition coefficient applied to the resulting object. This is useful to adjust the brightness of the final image. Defaults to 0.

plot

Logical, whether to display the resulting RGB image (default: TRUE).

Details

This function converts SpatRaster that contains the RGB bands into a three-band RGB image using pliman (EBImage). It allows you to specify the band indices for the red, green, and blue channels, as well as apply a scaling coefficient to the final image. By default, the resulting RGB image is displayed, but this behavior can be controlled using the plot parameter.

Value

A three-band RGB image represented as a pliman (EBImage) object.

Examples

library(pliman)
# Convert a mosaic raster to an RGB image and display it
mosaic <- mosaic_input(system.file("ex/elev.tif", package="terra"))

# Convert a mosaic raster to an RGB image without displaying it
rgb_image <- mosaic_to_rgb(c(mosaic * 2, mosaic - 0.3, mosaic * 0.8))
plot(rgb_image)



[Package pliman version 2.1.0 Index]