View source: R/regional_thresholding.R
regional_thresholding | R Documentation |
Regional thresholding of greyscale images.
regional_thresholding(
r,
segmentation,
method,
intercept = NULL,
slope = NULL,
prob = NULL
)
r |
SpatRaster. A normalized greyscale image. Typically, the
blue channel extracted from a canopy photograph. Please see |
segmentation |
SpatRaster. The result of segmenting |
method |
Character vector of length one. See details for current options. |
intercept, slope |
Numeric vector of length one. These are linear function coefficients. |
prob |
Numeric vector of length one. Probability for |
Methods currently implemented are:
Diaz2018: method presented in
\insertCiteDiaz2018;textualrcaiman applied regionally. If this method is
selected, the arguments intercept
, slope
, and prob
should be provided.
It works segment-wise extracting the digital numbers per segment and passing
them to stats::quantile()
along with prob
, which aggregated result is in
turn passed to thr_mblt()
along with intercept
and slope
. Finally, this
threshold image is applied to obtain a binarized image.
Methods from autothresholdr package: this function can call
methods from autothresholdr::auto_thresh()
. For instance, use "IsoData"
to use the algorithm by \insertCiteisodata;textualrcaiman, which was
recommended by \insertCiteJonckheere2005;textualrcaiman.
Method isodata from this package: Use "thr_isodata"
to
use thr_isodata()
.
An object of class SpatRaster with values 0
and 1
.
Other Binarization Functions:
apply_thr()
,
obia()
,
ootb_mblt()
,
ootb_obia()
,
thr_isodata()
,
thr_mblt()
## Not run:
path <- system.file("external/DSCN4500.JPG", package = "rcaiman")
caim <- read_caim(path, c(1250, 1020) - 745, 745 * 2, 745 * 2)
z <- zenith_image(ncol(caim), lens("Nikon_FCE9"))
r <- gbc(caim$Blue)
r <- correct_vignetting(r, z, c(0.0638, -0.101)) %>% normalize()
rings <- rings_segmentation(z, 15)
bin <- regional_thresholding(r, rings, "Diaz2018", -7.8, 0.95 * 0.5, 0.99)
plot(bin)
bin <- regional_thresholding(r, rings, "thr_isodata")
plot(bin)
#'
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.