img_contrast: Image contrast

View source: R/contrast.R

img_contrastR Documentation

Image contrast

Description

img_contrast returns the RMS contrast of an image img. A higher value indicates higher contrast.

Usage

img_contrast(img)

Arguments

img

An image in form of a matrix or array of numeric values. Use e.g. img_read() to read an image file into R.

Details

The function returns the RMS contrast of an image img. The RMS contrast is defined as the standard deviation of the normalized pixel intensity values. A higher value indicates higher contrast. The image is automatically normalized if necessary (i.e., normalization into range [0, 1]).

For color images, the weighted average between each color channel's values is computed.

Value

a numeric value (RMS contrast)

References

Peli, E. (1990). Contrast in complex images. Journal of the Optical Society of America A, 7, 2032–2040. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1364/JOSAA.7.002032")}

See Also

img_read, img_complexity, img_self_similarity, img_simplicity, img_symmetry, img_typicality,

Examples

# Example image with relatively high contrast: berries
berries <- img_read(system.file("example_images", "berries.jpg", package = "imagefluency"))
#
# display image
grid::grid.raster(berries)
#
# get contrast
img_contrast(berries)

# Example image with relatively low contrast: bike
bike <- img_read(system.file("example_images", "bike.jpg", package = "imagefluency"))
#
# display image
grid::grid.raster(bike)
#
# get contrast
img_contrast(bike)


stm/rquantae documentation built on Feb. 29, 2024, 4:08 p.m.