# colorfulness: Quantify the colorfulness of an image In rcaiman: CAnopy IMage ANalysis

 colorfulness R Documentation

## Quantify the colorfulness of an image

### Description

Quantify the colorfulness of an sRGB image using a bidimensional space formed by the green/red and the blue/yellow axes of the CIE L*a*b* space, symbolized with a* and b*, respectively. The proposed index is defined as the surface of the a*b* plane covered by colors from the image relative to the surface that the whole sRGB cube covers in the same plane, expressed in percentage.

### Usage

```colorfulness(caim, m = NULL, plot = FALSE)
```

### Arguments

 `caim` SpatRaster. The return of a call to `read_caim`. `m` SpatRaster. A mask. For hemispherical photographs, check `mask_hs`. Default (`NULL`) is the equivalent to enter `!is.na(caim\$Red)`. `plot` Logical vector of length one. If is `TRUE`, a plot will be send to the graphic device, showing the data on the CIE a*b* space.

### Details

Pixels from the image covered by pixels from `m` with value `1` will be taking into account in the computations.

If `plot = TRUE` is used, a plot is sent to the active graphics device. It shows the color from the image plotted into a bidimensional space made by the axis a* and b* of the CIE L*a*b* space.

An early version of this function was used in \insertCiteMartin2020;textualrcaiman.

### Value

A numeric vector of length one and, if the argument `plot` is `TRUE`, an object returned by `plot` is send to the graphic device.

### References

\insertAllCited

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

### Examples

```caim <- read_caim() %>% normalize()
plotRGB(caim*255)
colorfulness(caim)

path <- system.file("external/DSCN4500.JPG", package = "rcaiman")
caim <- read_caim(path, c(1280, 960) - 745, 745 * 2, 745 * 2) %>% normalize()
plotRGB(caim*255)
colorfulness(caim)
```

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