Learn R Programming

rcaiman (version 2.0.1)

crop_caim: Crop a canopy image

Description

Extracts a rectangular region of interest (ROI) from a canopy image. This function complements read_caim() and read_caim_raw().

Usage

crop_caim(r, upper_left = NULL, width = NULL, height = NULL)

Value

terra::SpatRaster object containing the same layers and values as r but restricted to the selected ROI, preserving all other properties.

Arguments

r

terra::SpatRaster.

upper_left

numeric vector of length two. Pixel coordinates of the upper-left corner of the ROI, in the format c(column, row).

width, height

numeric vector of length one. Size (in pixels) of the rectangular ROI to read.

Examples

Run this code
caim <- read_caim()
ncell(caim)
caim <- crop_caim(caim, c(231,334), 15, 10)
ncell(caim)

Run the code above in your browser using DataLab