Transform background digital number into threshold values.
thr_image(dn, intercept, slope)
Numeric vector or SpatRaster. Digital number of the background. These values should be normalized and, if they are extracted from a JPEG image, gamma back corrected.
Numeric vector of length one. These are linear
function coefficients–see section Details in
This function transforms background digital numbers into threshold values by
means of the Equation 1 from \insertCiteDiaz2018;textualrcaiman, which is
a linear function with the slope modified by a weighting parameter. This
simple function was found by studying canopy models, also known as targets,
which are perforated surfaces made of a rigid and dark material. These models
were backlighted with homogeneous lighting, photographed with a Nikon Coolpix
5700 set to acquire in JPEG format, and those images were gamma back
corrected with a default gamma value equal to 2.2 (see
Results clearly shown that the optimal threshold value was linearly related
with the background digital number, shifting the aim from
finding the optimal threshold to obtaining the background DN as if the canopy
was not there. Functions
fit_trend_surface address that topic.
It is worth noting that Equation 1 was developed with 8-bit images, so
calibration of new coefficient should be done in the 0 to 255 domain since
that is what
thr_image expect, although the input
should be normalized. The latter was a design decision aiming to harmonize
the whole package, although it might sound counter intuitive.
To apply the weighting parameter (w) from Equation 1, just provide the
slope as slope \times w.
thr_image–no parenthesis–in the console to inspect the code,
which is very simple to follow.
An object of the same class and dimensions than
Other Binarization Functions:
thr_image(gbc(125), -8, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.