# defuzzify: Defuzzify fuzzy classification In rcaiman: CAnopy IMage ANalysis

 defuzzify R Documentation

## Defuzzify 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 \insertCiteLang2013rcaiman–into a binary product.

### Usage

```defuzzify(mem, segmentation)
```

### 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`.

### Details

This method is also available in the HSP software package \insertCiteLang2013rcaiman.

### Value

An object of the class SpatRaster containing binary information.

### References

\insertAllCited

Other Tool Functions: `colorfulness()`, `extract_dn()`, `extract_feature()`, `extract_rl()`, `extract_sky_points()`, `masking()`, `read_bin()`, `read_caim()`, `write_bin()`, `write_caim()`

### Examples

```## Not run:
path <- system.file("external/DSCN4500.JPG", package = "rcaiman")
caim <- read_caim(path, c(1280, 960) - 745, 745 * 2, 745 * 2)
z <- zenith_image(ncol(caim), lens("Nikon_FCE9"))
a <- azimuth_image(z)
r <- gbc(caim\$Blue)
r[is.na(z)] <- 0 # because FOV > 180
bin <- ootb_mblt(r, z, a)
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(bin\$bin - bin2)

## End(Not run)
```

rcaiman documentation built on Sept. 20, 2022, 1:05 a.m.