Skip to contents

countNonZero returns the number of non-zero pixels in an Image object.

Usage

countNonZero(image)

Arguments

image

A single-channel Image object.

Value

An integer.

See also

Author

Simon Garnier, garnier@njit.edu

Examples

balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
changeColorSpace(balloon, "GRAY", "self")
#> NULL
countNonZero(balloon > 100)
#> [1] 169254