Learn R Programming

lidaRtRee (version 4.0.8)

raster2Cimg: SpatRaster to Cimg conversion

Description

converts a SpatRaster object to cimg object. NA values in raster are replaced.

Usage

raster2Cimg(r, NA_replace = 0, maxpixels = 1e+10)

Value

A cimg object

Arguments

r

SpatRaster object. raster of canopy height model, preferably filtered to avoid effect of holes on volume and surface computation

NA_replace

numeric. value to replace NA values with.

maxpixels

numeric. maximum number of pixels to be converted to cimg (argument passed to as.cimg).

See Also

cimg2Raster

Examples

Run this code
data(chm_chablais3)
chm_chablais3 <- terra::rast(chm_chablais3)

chm_cim <- raster2Cimg(chm_chablais3)
chm_cim
summary(chm_cim)

# plot SpatRaster
terra::plot(chm_chablais3)

# plot cimg object
plot(chm_cim)

Run the code above in your browser using DataLab