local_fuzzy_thresholding: Local fuzzy thresholding

local_fuzzy_thresholdingR Documentation

Local fuzzy thresholding

Description

This function was first presented in \insertCiteDiaz2015;textualrcaiman. 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 normalize()).

m

SpatRaster. A mask. For hemispherical photographs, check mask_hs().

mem

SpatRaster. It is the scale parameter of the logistic membership function. Typically it is obtained with membership_to_color().

thr

Numeric vector of length one. Location parameter of the logistic membership function. Use NULL to estimate it automatically with thr_isodata().

fuzziness

Numeric vector of length one. This number is a constant value that scales mem. Use NULL to estimate it automatically as the midpoint between the maximum and minimum values of lightness.

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 \insertCiteDiaz2015;textualrcaiman 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

\insertAllCited

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)

rcaiman documentation built on Nov. 15, 2023, 1:08 a.m.