| image_index {pliman} | R Documentation |
Image indexes
Description
image_index() Builds image indexes using Red, Green, Blue, Red-Edge, and NIR bands.
Generates a raster or density plot of the index values computed with
image_index().
Usage
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, ...)
Arguments
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 |
Details
The following indexes are available in pliman.
RGB color space
-
Rred -
Ggreen -
Bblue -
NRnormalized redR/(R+G+B). -
NGnormalized greenG/(R+G+B) -
NBnormalized blueB/(R+G+B) -
GBgreen blue ratioG/B -
RBred blue ratioR/B -
GRgreen red ratioG/R -
BIbrightness Indexsqrt((R^2+G^2+B^2)/3) -
BIMbrightness Index 2sqrt((R*2+G*2+B*2)/3) -
SCISoil Colour Index(R-G)/(R+G) -
GLIGreen leaf index Vis Louhaichi et al. (2001)(2*G-R-B)/(2*G+R+B) -
HIPrimary colours Hue Index (2*R-G-B)/(G-B) -
NDGRINormalized green red difference index (Tucker, 1979)(G-R)/(G+R) -
NDGBINormalized green blue difference index(G-B)/(G+B) -
NDRBINormalized red blue difference index(R-B)/(R+B) -
IR+G+B -
S((R+G+B)-3*B)/(R+G+B) -
LR+G+B/3 -
VARIA Visible Atmospherically Resistant Index(G-R)/(G+R-B) -
HUEOverall Hue Indexatan(2*(B-G-R)/30.5*(G-R)) -
HUE2atan(2*(R-G-R)/30.5*(G-B)) -
BGIB/G -
GRAY0.299*R + 0.587*G + 0.114*B -
GRAY2((R^2.2+(1.5*G)^2.2+(0.6*B)^2.2)/(1+1.5^2.2+0.6^2.2))^1/2.2 -
GLAI(25*(G-R)/(G+R-B)+1.25) -
CIColoration Index(R-B)/R -
SATOverhall Saturation Index(max(R,G,B) - min(R,G,B)) / max(R,G,B) -
SHPShape Index2*(R-G-B)/(G-B) -
RIRedness IndexR**2/(B*G**3)
HSB color space
-
DGCIDark Green Color Index, based on HSB color space60\*((G - B) / (max(R, G, B) - min(R, G, B))) CIE-Lab color space
-
L*: relative luminance(0.2126 * R + 0.7152 * G + 0.0722 * B) -
a*:0.55*( (R - (0.2126 * R + 0.7152 * G + 0.0722 * B)) / (1.0 - 0.2126))
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.
Value
A list containing Grayscale images. The length will depend on the number of indexes used.
A NULL object
Author(s)
Tiago Olivoto tiagoolivoto@gmail.com
References
Nobuyuki Otsu, "A threshold selection method from gray-level histograms". IEEE Trans. Sys., Man., Cyber. 9 (1): 62-66. 1979. doi:10.1109/TSMC.1979.4310076
Examples
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")