thr_mblt {rcaiman} | R Documentation |
Calculate thresholds with the model-based method
Description
Transform background digital number into threshold values
Usage
thr_mblt(dn, intercept, slope)
Arguments
dn |
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. |
intercept , slope |
Numeric vector of length one. These are linear function coefficients. |
Details
This function transforms background digital numbers into threshold values by
means of the Equation 1 from Díaz and Lencinas (2018), 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 gbc()
). Results
shown that the optimal threshold value was linearly related with the
background digital number (see Figure 1 and Figure 7 from
Díaz and Lencinas (2018)). This shifted the aim from finding
the optimal threshold, following Song et al. (2014)
method, to obtaining the background DN as if the canopy was not there, as
Lang et al. (2010) proposed.
Working principle
Díaz and Lencinas (2018) observed the following linear relationship between the background value, usually the sky digital number (SDN), and the optimal threshold value (OTV):
IV = a + b \cdot SDN | (Equation 1a) | |||||||||||
OTV = a + b \cdot w \cdot SDN | (Equation 1b) | |||||||||||
were IV is the initial value (Wagner 2001), which is the
boundary between SDN and the mixed pixels, i.e, the pixels that are neither
Gap or Non-gap (Macfarlane 2011), a
and b
are the intercept and slope coefficients, respectively, and w
is a
weighting parameter that takes into account that OTV is always lower than IV.
If SDN is calculated at the pixel level, a local thresholding method can be
applied by evaluating, pixel by pixel, if the below canopy digital number
(CDN) is greater than the OTV. Formally, If CDN>OTV
, then assign Gap
class, else assign Non-gap class.
This conclusion drawn from an image processing point of view matches with previous findings drawn from a radiometric measurement paradigm, which are introduced next.
Cescatti (2007) posed that cameras can be used as a radiation measurement device if they are properly calibrated. This method, denominated by the author as LinearRatio, seeks to obtain the transmittance (T) as the ratio of below to above canopy radiation:
T = CDN/SDN | (Equation 2) | |||||||||||
were CDN is below canopy digital number (DN), i.e., the DN extracted from a canopy hemispherical photograph.
The LinearRatio method uses T as a proxy for gap fraction. It requires twin cameras, one below and the other above the canopy. In contrast, Lang et al. (2010) proposed to obtain SDN by manually selecting pure sky pixels from canopy hemispherical photographs and reconstructing the whole sky by subsequent modeling and interpolating—this method is often referred to as LinearRatio single camera or LinearRatioSC.
Equation 2 can be seen as a standardization of the distance between CDN and SDN. With that in mind, it is useful to rewrite Equation 1b as an inequality that can be evaluated to return a logical statement that is directly translated into the desired binary classification:
CDN > a + b \cdot w \cdot SDN | (Equation 3) | |||||||||||
Then, combining Equation 2 and 3, we find that Díaz and Lencinas (2018) parameters can be applied to T:
CDN/SDN > a + b \cdot w \cdot SDN/SDN | (Equation 4a) | |||||||||||
T > a + b \cdot w | (Equation 4b) | |||||||||||
From Equation 2 it is evident that any bias introduced by the camera optical and electronic system will be canceled during the calculation of T as long as only one camera is involved. Therefore, After examining Equation 4b, we can conclude that intercept 0 and slope 1 are theoretically correct.In addition, the w parameter can be used to filter out mixed pixels. The greater w, the greater the possibility of selecting pure sky pixels.
Value
An object of the same class and dimensions than dn
.
Note
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_mblt()
expect, although the dn
argument should be
normalized. The latter, in spite of sounding counter intuitive, was a design
decision aiming to harmonize the whole package.
Nevertheless, new empirical calibration on JPEG files may be unnecessary
since the values -7.8 intercept
and 0.95 slope
that had been observed
with back-gamma corrected JPEG files produced with the Nikon Coolpix 5700
camera are sufficiently close to the theoretical values that it sounds
reasonable to interpret them as a confirmation of the theory.
Users are encouraged to adopt raw file acquisition (read_caim_raw()
).
To apply the weighting parameter (w) from Equation 1, just provide the
argument slope
as slope \times w
.
References
Cescatti A (2007).
“Indirect estimates of canopy gap fraction based on the linear conversion of hemispherical photographs.”
Agricultural and Forest Meteorology, 143(1-2), 1–12.
doi:10.1016/j.agrformet.2006.04.009.
Díaz GM, Lencinas JD (2018).
“Model-based local thresholding for canopy hemispherical photography.”
Canadian Journal of Forest Research, 48(10), 1204–1216.
doi:10.1139/cjfr-2018-0006.
Lang M, Kuusk A, M~ottus M, Rautiainen M, Nilson T (2010).
“Canopy gap fraction estimation from digital hemispherical images using sky radiance models and a linear conversion method.”
Agricultural and Forest Meteorology, 150(1), 20–29.
doi:10.1016/j.agrformet.2009.08.001.
Macfarlane C (2011).
“Classification method of mixed pixels does not affect canopy metrics from digital images of forest overstorey.”
Agricultural and Forest Meteorology, 151(7), 833–840.
doi:10.1016/j.agrformet.2011.01.019.
Song GM, Doley D, Yates D, Chao K, Hsieh C (2014).
“Improving accuracy of canopy hemispherical photography by a constant threshold value derived from an unobscured overcast sky.”
Canadian Journal of Forest Research, 44(1), 17–27.
doi:10.1139/cjfr-2013-0082.
Wagner S (2001).
“Relative radiance measurements and zenith angle dependent segmentation in hemispherical photography.”
Agricultural and Forest Meteorology, 107(2), 103–115.
doi:10.1016/s0168-1923(00)00232-x.
See Also
normalize()
, gbc()
, apply_thr()
and regional_thresholding()
.
Other Binarization Functions:
apply_thr()
,
obia()
,
ootb_mblt()
,
ootb_obia()
,
regional_thresholding()
,
thr_isodata()
Examples
thr_mblt(gbc(125), -7.8, 0.95 * 0.5)