sub-.Rcpp_Image: Extract or Replace Parts of an Image

[.Rcpp_ImageR Documentation

Extract or Replace Parts of an Image

Description

Operators acting on Image objects to extract or replace parts.

Usage

## S3 method for class 'Rcpp_Image'
x[...]

## S3 replacement method for class 'Rcpp_Image'
x[i = NULL, j = NULL] <- value

Arguments

x

An Image object.

...

Other arguments passed to [ when extracting parts. In this case, the function treat that image as an R array and will accept/require the same arguments.

i, j

Indices specifying elements to extract or replace. Indices are numeric vectors which values are coerced to integer as by as.integer (and hence truncated towards zero) or logical vectors which are recycled if necessary to match the dimensions of the image.

value

Vector or matrix with the data to replace the pixels. Typically, this is a matrix with the same number of rows as the number of channels in image, similar to that produced by col2rgb.

Author(s)

Simon Garnier, garnier@njit.edu

See Also

Image, col2bgr

Examples

balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
balloon[1:100, 1:100, ]
balloon[1:100, 1:100] <- col2rgb(c("red", "green", "blue", "yellow"))


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