image_index | R Documentation |
image_index()
Builds image indexes using Red, Green, Blue, Red-Edge, and
NIR bands. See this page for a
detailed list of available indexes.
The S3 method plot()
can be used to generate a raster or density plot of
the index values computed with image_index()
image_index(
img,
index = NULL,
r = 1,
g = 2,
b = 3,
re = 4,
nir = 5,
return_class = c("ebimage", "terra"),
resize = FALSE,
has_white_bg = FALSE,
plot = TRUE,
nrow = NULL,
ncol = NULL,
max_pixels = 1e+05,
parallel = FALSE,
workers = NULL,
verbose = TRUE,
...
)
## S3 method for class 'image_index'
plot(x, type = c("raster", "density"), nrow = NULL, ncol = NULL, ...)
img |
An |
index |
A character value (or a vector of characters) specifying the
target mode for conversion to a binary image. Use |
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. |
return_class |
The class of object to be returned. If |
resize |
Resize the image before processing? Defaults to |
has_white_bg |
Logical indicating whether a white background is present. If TRUE, pixels that have R, G, and B values equals to 1 will be considered as NA. This may be useful to compute an image index for objects that have, for example, a white background. In such cases, the background will not be considered for the threshold computation. |
plot |
Show image after processing? |
nrow , ncol |
The number of rows or columns in the plot grid. Defaults to
|
max_pixels |
integer > 0. Maximum number of cells to plot the index. If
|
parallel |
Processes the images asynchronously (in parallel) in separate
R sessions running in the background on the same machine. It may speed up
the processing time when |
workers |
A positive numeric scalar or a function specifying the maximum number of parallel processes that can be active at the same time. |
verbose |
If |
... |
Additional arguments passed to |
x |
An object of class |
type |
The type of plot. Use |
When type = "raster"
(default), the function calls plot_index()
to create a raster plot for each index present in x
. If type = "density"
,
a for loop is used to create a density plot for each index. Both types of
plots can be arranged in a grid controlled by the ncol
and nrow
arguments.
A list containing Grayscale images. The length will depend on the number of indexes used.
A NULL
object
Tiago Olivoto tiagoolivoto@gmail.com
Nobuyuki Otsu, "A threshold selection method from gray-level histograms". IEEE Trans. Sys., Man., Cyber. 9 (1): 62-66. 1979. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1109/TSMC.1979.4310076")}
Karcher, D.E., and M.D. Richardson. 2003. Quantifying Turfgrass Color Using Digital Image Analysis. Crop Science 43(3): 943–951. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2135/cropsci2003.9430")}
Bannari, A., D. Morin, F. Bonn, and A.R. Huete. 1995. A review of vegetation indices. Remote Sensing Reviews 13(1–2): 95–120. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/02757259509532298")}
library(pliman)
img <- image_pliman("soybean_touch.jpg")
image_index(img, index = c("R, NR"))
# Example for S3 method plot()
library(pliman)
img <- image_pliman("sev_leaf.jpg")
# compute the index
ind <- image_index(img, index = c("R, G, B, NGRDI"), plot = FALSE)
plot(ind)
# density plot
plot(ind, type = "density")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.