masking: Image masking

maskingR Documentation

Image masking

Description

Image masking

Usage

masking(r, m, RGB = c(1, 0, 0))

Arguments

r

SpatRaster. The image. Values should be normalized, see normalize(). Only methods for images with one or three layers have been implemented.

m

SpatRaster. A mask. For hemispherical photographs, check mask_hs().

RGB

Numeric vector of length three. RGB color code. Red is the default color.

Value

An object of class SpatRaster that essentially is r with areas where m is equal to zero painted in a solid color. If r is a single layer image, then the layer is triplicated to allow the use of color.

See Also

mask_hs()

Other Tool Functions: colorfulness(), correct_vignetting(), defuzzify(), extract_dn(), extract_feature(), extract_rl(), extract_sky_points_simple(), extract_sky_points(), extract_sun_coord(), find_sky_pixels_nonnull(), find_sky_pixels(), optim_normalize(), percentage_of_clipped_highlights(), read_bin(), read_caim_raw(), read_caim(), write_bin(), write_caim()

Examples

## Not run: 
 r <- read_caim()
 z <- zenith_image(ncol(r), lens())
 a <- azimuth_image(z)
 m <- mask_hs(z, 20, 70) & mask_hs(a, 90, 180)

 masked_caim <-  masking(normalize(r), m)
 plotRGB(masked_caim * 255)

 masked_bin <- masking(apply_thr(r$Blue, 125), m)
 plotRGB(masked_bin * 255)
 
## End(Not run)


rcaiman documentation built on Nov. 15, 2023, 1:08 a.m.