Learn R Programming

rcaiman (version 1.2.2)

defuzzify: Defuzzify a fuzzy classification

Description

This function translates degree of membership into Boolean logic using a regional approach. The result will ensure that the fuzzy and Boolean version will agree at the chosen level of aggregation (controlled by the argument segmentation). This method makes perfect sense to translate a subpixel classification of gap fraction (or a linear ratio) into a binary product.

Usage

defuzzify(mem, segmentation)

Value

An object of the class SpatRaster containing binary information.

Arguments

mem

An object of the class SpatRaster. Degree of membership.

segmentation

An object of the class SpatRaster such as the result of a call to sky_grid_segmentation().

References

See Also

Other Tool Functions: colorfulness(), correct_vignetting(), extract_dn(), extract_feature(), extract_rl(), extract_sky_points_simple(), extract_sky_points(), extract_sun_coord(), find_sky_pixels_nonnull(), find_sky_pixels(), masking(), optim_normalize(), percentage_of_clipped_highlights(), read_bin(), read_caim_raw(), read_caim(), write_bin(), write_caim()

Examples

Run this code
if (FALSE) {
path <- system.file("external/DSCN4500.JPG", package = "rcaiman")
caim <- read_caim(path, c(1250, 1020) - 745, 745 * 2, 745 * 2)
z <- zenith_image(ncol(caim), lens("Nikon_FCE9"))
a <- azimuth_image(z)
r <- gbc(caim$Blue)
r <- correct_vignetting(r, z, c(0.0638, -0.101)) %>% normalize()
bin <- find_sky_pixels(r, z, a)
bin <- ootb_mblt(r, z, a, bin)
plot(bin$bin)
ratio <- r / bin$sky_s
ratio <- normalize(ratio, 0, 1, TRUE)
plot(ratio)
g <- sky_grid_segmentation(z, a, 10)
bin2 <- defuzzify(ratio, g)
plot(bin2)
plot(abs(bin$bin - bin2))
}

Run the code above in your browser using DataLab