img_contrast {imagefluency} | R 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.
|
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. 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)