local_fuzzy_thresholding {rcaiman} | R Documentation |
Local fuzzy thresholding
Description
This function was first presented in Díaz and Lencinas (2015).
It uses a threshold value as the location parameter of a logistic membership
function whose scale parameter depends on a variable, here named mem
. This
dependence can be explained as follows: if the variable is equal to 1
, then
the membership function is same as a threshold function because the scale
parameter is 0
; lowering the variable increases the scale parameter, thus
blurring the threshold because it decreases the steepness of the curve. Since
the variable is defined pixel by pixel, this should be considered as a
local fuzzy thresholding method.
Usage
local_fuzzy_thresholding(lightness, m, mem, thr = NULL, fuzziness = NULL)
Arguments
lightness |
SpatRaster. A normalized greyscale image (see
|
m |
SpatRaster. A mask. For hemispherical photographs,
check |
mem |
SpatRaster. It is the scale parameter of the logistic
membership function. Typically it is obtained with |
thr |
Numeric vector of length one. Location parameter of the logistic
membership function. Use |
fuzziness |
Numeric vector of length one. This number is a constant
value that scales |
Details
Argument m
can be used to affect the automatic estimation of thr
and
fuzziness
.
If you use this function in your research, please cite
Díaz and Lencinas (2015) in addition to this package
(citation("rcaiman"
).
Value
An object of class SpatRaster with same pixel dimensions than
caim
. Depending on mem
, changes could be subtle.
References
Díaz GM, Lencinas JD (2015). “Enhanced gap fraction extraction from hemispherical photography.” IEEE Geoscience and Remote Sensing Letters, 12(8), 1785–1789. doi:10.1109/lgrs.2015.2425931.
See Also
Other Pre-processing Functions:
enhance_caim()
,
gbc()
,
membership_to_color()
,
normalize()
Examples
## Not run:
caim <- read_caim()
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
caim <- normalize(caim)
# ImageJ can be used to digitize points
path <- system.file("external/sky_points.csv",
package = "rcaiman")
img_points <- read.csv(path)
img_points <- img_points[c("Y", "X")]
colnames(img_points) <- c("row", "col")
head(img_points)
target_color <- extract_dn(caim, img_points, fun = median)
as(target_color, "HSV")
target_color <- HSV(240, 0.85, 0.5) #to increase saturation
mem <- membership_to_color(caim, target_color)
mem_thr <- local_fuzzy_thresholding(mean(caim), m, mem$membership_to_grey)
plot(mem_thr)
## End(Not run)