Learn R Programming

Rvision (version 0.6.0)

findNonZero: 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.

See Also

Image

Examples

Run this code
# NOT RUN {
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
balloon_gray <- changeColorSpace(balloon, "GRAY")
findNonZero(balloon_gray)

# }

Run the code above in your browser using DataLab