Learn R Programming

Rvision (version 0.4.2)

inRange: Range Thresholding

Description

inRange performs range thresholding on an Image object. Pixels which values are within the desired range are turned white while pixels which values are outside are turned black. This operation is performed separately on each channel for multi-channel images.

Usage

inRange(image, low = rep(0, 4), up = rep(255, 4))

Arguments

image

An Image object.

low

A vector indicating the lower end of the thresholding range. The can have as many elements as the number of channels in the image. If it has less elements than the number of channels, it is recycled to match the number of channels. If it has more elements than the number of channels, the extra elements are ignored without warning (default: rep(0, 4)).

up

A vector indicating the upper end of the thresholding range. The can have as many elements as the number of channels in the image. If it has less elements than the number of channels, it is recycled to match the number of channels. If it has more elements than the number of channels, the extra elements are ignored without warning (default: rep(255, 4)).

Value

An Image object.

See Also

Image

Examples

Run this code
# NOT RUN {
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
bw <- inRange(balloon, low = c(10, 20, 30), up = c(120, 130, 140))
plot(bw)

# }

Run the code above in your browser using DataLab