Computes distances between objects in an anal_obj
object and returns a list
of distances, coefficient of variation (CV), and means.
Usage
object_map(object, by_column = "img", direction = c("horizontal", "vertical"))
Arguments
- object
An
anal_obj
object computed withanalyze_objects_shp()
.- by_column
The column name in the object's results data frame to group objects by. Default is "img".
- direction
The direction of mapping. Should be one of "horizontal" or "vertical". Default is "horizontal".
Value
A list with the following components:
- distances
A list of distances between objects grouped by unique values in the specified column/row.
- cvs
A vector of coefficient of variation (CV) values for each column/row.
- means
A vector of mean distances for each column/row.
Examples
if(interactive()){
library(pliman)
flax <- image_pliman("flax_leaves.jpg", plot =TRUE)
res <-
analyze_objects_shp(flax,
nrow = 3,
ncol = 1,
watershed = FALSE,
index = "R/(G/B)",
plot = FALSE)
plot(res$final_image_mask)
plot(res$shapefiles)
# distance from each leave within each row
result <- object_map(res)
result$distances
result$cvs
result$means
}