findNonZero: Find Non-Zero Pixels in an Image

View source: R/logical.R

findNonZeroR Documentation

Find Non-Zero Pixels in an Image

Description

findNonZero retrieves the locations of all non-zero pixels in an image.

Usage

findNonZero(image, values = FALSE)

Arguments

image

A single-channel Image object.

values

A logical indicating whether the values of the non-zero pixels should also be returned (default: FALSE).

Value

If values=FALSE, a matrix with two columns, corresponding to the x (columns) and y (rows) coordinates of the non-zero pixels. If values=TRUE, an additional column corresponding to the pixel values will also be returned.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

Image

Examples

balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
balloon_gray <- changeColorSpace(balloon, "GRAY")
findNonZero(balloon_gray)


swarm-lab/Rvision documentation built on Feb. 7, 2024, 4:59 a.m.