Learn R Programming

Rvision (version 0.4.2)

sum: Sum Generic for Image objects

Description

Overloaded sum to handle Image objects and lists of Image objects.

Usage

sum(x, ..., na.rm = FALSE)

Arguments

x

An Image object or a list of Image objects.

...

Further arguments passed to summary methods.

na.rm

Not used but retained for compatibility with base sum.

Value

If x is an Image object, the function returns a numeric value (for single-channel images) or a vector of numeric values (for multi-channel images). If x is a list of Image objects, the function returns an Image object corresponding to the pixelwise sum of the images in the list.

See Also

Image

Examples

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

balloon_vid <- video(system.file("sample_vid/Balloon.mp4", package = "Rvision"))
img_list <- lapply(1:10, function(x) readNext(balloon_vid))
sum(img_list)

# }

Run the code above in your browser using DataLab