membership_to_color: Compute the membership to a target color

View source: R/membership_to_color.R

membership_to_colorR Documentation

Compute the membership to a target color

Description

This function was first presented in \insertCiteDiaz2015;textualrcaiman. It computes the degree of membership to a color using two Gaussian membership functions and the axes A and B from the CIE LAB color space. The lightness dimension is not considered in the calculations.

Usage

membership_to_color(caim, target_color, sigma = NULL)

Arguments

caim

SpatRaster. The return of a call to read_caim() or read_caim_raw().

target_color

color.

sigma

Numeric vector of length one. Use NULL (default) to estimate it automatically as the euclidean distance between target_color and grey in the CIE LAB color space.

Details

If you use this function in your research, please cite \insertCiteDiaz2015;textualrcaiman in addition to this package (⁠citation("rcaiman"⁠).

Value

It returns an object from the class SpatRaster. First layer is the membership to the target color. Second layer is the membership to grey. Both memberships are calculated with same sigma.

References

\insertAllCited

See Also

Other Pre-processing Functions: enhance_caim(), gbc(), local_fuzzy_thresholding(), normalize()

Examples

## Not run: 
caim <- read_caim() %>% normalize
z <- zenith_image(ncol(caim), lens())
a <- azimuth_image(z)
m <- !is.na(z)

sky_blue <- HSV(239, 0.85, 0.5)
mem <- membership_to_color(caim, sky_blue)
plot(mem)

## End(Not run)

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