analyze_objects_shp | R Documentation |
Analyzes objects using shapefiles
analyze_objects_shp(
img,
nrow = 1,
ncol = 1,
buffer_x = 0,
buffer_y = 0,
prepare = FALSE,
segment_objects = TRUE,
viewer = get_pliman_viewer(),
index = "R",
r = 1,
g = 2,
b = 3,
re = 4,
nir = 5,
shapefile = NULL,
interactive = FALSE,
plot = FALSE,
parallel = FALSE,
workers = NULL,
watershed = TRUE,
filter = FALSE,
object_size = "medium",
efourier = FALSE,
object_index = NULL,
veins = FALSE,
width_at = FALSE,
verbose = TRUE,
invert = FALSE,
...
)
img |
An |
nrow, ncol |
The number of rows and columns to generate the shapefile
when |
buffer_x, buffer_y |
Buffering factor for the width and height, respectively, of each individual shape's side. A value between 0 and 0.5 where 0 means no buffering and 0.5 means complete buffering (default: 0). A value of 0.25 will buffer the shape by 25% on each side. |
prepare |
Logical value indicating whether to prepare the image for
analysis using |
segment_objects |
Segment objects in the image? Defaults to |
viewer |
The viewer option. If not provided, the value is retrieved
using |
index |
A character value specifying the target mode for conversion to
binary image when |
r, g, b, re, nir |
The red, green, blue, red-edge, and near-infrared bands of the image, respectively. Defaults to 1, 2, 3, 4, and 5, respectively. If a multispectral image is provided (5 bands), check the order of bands, which are frequently presented in the 'BGR' format. |
shapefile |
(Optional) An object created with |
interactive |
If |
plot |
Plots the processed images? Defaults to |
parallel |
If |
workers |
A positive numeric scalar or a function specifying the number of parallel processes that can be active at the same time. By default, the number of sections is set up to 30% of available cores. |
watershed |
If |
filter |
Performs median filtering in the binary image? See more at
|
object_size |
Argument to control control the watershed segmentation.
See |
efourier |
Logical argument indicating if Elliptical Fourier should be
computed for each object. This will call |
object_index |
Defaults to |
veins |
Logical argument indicating whether vein features are computed.
This will call |
width_at |
Logical. If |
verbose |
If |
invert |
Inverts the binary image if desired. This is useful to process
images with a black background. Defaults to |
... |
Aditional arguments passed on to analyze_objects. |
The analyze_objects_shp
function performs object analysis on an
image and generates shapefiles representing the analyzed objects. The
function first prepares the image for analysis using the image_prepare()
function if the prepare
argument is set to TRUE
. If a shapefile object is
provided, the number of rows and columns for splitting the image is obtained
from the shapefile. Otherwise, the image is split into multiple sub-images
based on the specified number of rows and columns using the
object_split_shp()
function. The objects in each sub-image are analyzed
using the analyze_objects()
function, and the results are stored in a list.
If parallel processing is enabled, the analysis is performed in parallel
using multiple workers.
The output object provides access to various components of the analysis results, such as the analyzed object coordinates and properties. Additionally, the shapefiles representing the analyzed objects are included in the output object for further analysis or visualization.
An object of class anal_obj
. See more details in the Value
section of analyze_objects()
.
if(interactive()){
library(pliman)
# Computes the DGCI index for each flax leaf
flax <- image_pliman("flax_leaves.jpg", plot =TRUE)
res <-
analyze_objects_shp(flax,
nrow = 3,
ncol = 5,
plot = FALSE,
object_index = "DGCI")
plot(flax)
plot(res$shapefiles)
plot_measures(res, measure = "DGCI")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.