Skip to contents

Returns the pixelwise mean of Image objects stored in a list.

Usage

# S3 method for class 'list'
mean(x, target = "new", ...)

Arguments

x

A list of Image objects. All images must have the same dimensions, number of channels, and bit depth.

target

The location where the results should be stored when passing a list of images to the function. It can take 3 values:

"new":

a new Image object is created and the results are stored inside (the default).

An Image object:

the results are stored in another existing Image object. This is fast but will replace the content of target. Note that target should have the same dimensions and number of channels as the images in the list, otherwise an error will be thrown.

...

Further arguments passed to summary methods. Unused if x is a list of images.

Value

If target="new", the function returns an Image object. If target is an Image object, the function returns nothing and modifies that Image object in place.

See also

Author

Simon Garnier, garnier@njit.edu

Examples

balloon <- video(system.file("sample_vid/Balloon.mp4", package = "Rvision"))
#> Error: Could not open the video.
img_list <- lapply(1:10, function(x) readNext(balloon))
#> Error in FUN(X[[i]], ...): object 'balloon' not found
mean_img <- mean(img_list)
#> Error in eval(expr, envir, enclos): object 'img_list' not found