| extract_feature {rcaiman} | R Documentation |
Extract feature
Description
Extract features from raster images.
Usage
extract_feature(
r,
segmentation,
fun = mean,
return_raster = TRUE,
ignore_label_0 = TRUE
)
Arguments
r |
SpatRaster. Single layer raster. |
segmentation |
SpatRaster. The segmentation of |
fun |
A |
return_raster |
Logical vector of length one, see details. |
ignore_label_0 |
Logical vector of length one. If this is |
Details
Given a single-layer raster, a segmentation, and a function,
extract_features will return a numeric vector or a SpatRaster
depending on whether the parameter return_raster is TRUE or FALSE. For
the first case, each pixel of each segment will adopt the respective
extracted feature value. For the second case, the return will be a vector of
length equal to the total number of segments. Each value will be obtained by
processing all pixels that belong to a segment with the provided function.
Value
If return_raster is set to TRUE, then an object of
class SpatRaster with the same pixel dimensions than r
will be returned. Otherwise, the return is a numeric vector of length equal
to the number of segments found in segmentation.
See Also
Other Tool Functions:
colorfulness(),
correct_vignetting(),
defuzzify(),
extract_dn(),
extract_rl(),
extract_sky_points_simple(),
extract_sky_points(),
extract_sun_coord(),
find_sky_pixels_nonnull(),
find_sky_pixels(),
masking(),
optim_normalize(),
percentage_of_clipped_highlights(),
read_bin(),
read_caim_raw(),
read_caim(),
write_bin(),
write_caim()
Examples
r <- read_caim()
z <- zenith_image(ncol(r),lens())
a <- azimuth_image(z)
g <- sky_grid_segmentation(z, a, 10)
print(extract_feature(r$Blue, g, return_raster = FALSE))
# plot(extract_feature(r$Blue, g, return_raster = TRUE))