backgrounder: Generate a background image from a video

Description Usage Arguments Details Value See Also Examples

Description

This function computes the background image of a video. It tries to determine the background value of each pixel by approximating its central value, either as the mean or as the median of a given number n of images spread throughout the video.

Usage

1
backgrounder(video, n = 10, method = "mean", color = FALSE)

Arguments

video

A vpVideo object from which a background image need to be computed.

n

The number of images to extract from the video in order to compute the background image. The images are taken at evenly spaced intervals throughout the video. The default is 10. Larger numbers will result in better accuracy, but might take longer to compute.

method

The type of computation to be performed in order to obtain the background image. The possible values are "mean" (default) and "median". "mean" is faster but is usually less accurate than "median".

color

A logical value indicating if the the background image should be color (TRUE) or grayscale (FALSE, default). Grayscale background image are faster to compute.

Details

The vpImage object created by the backgrounder function is not a persistent object, but a pointer to a C++ object that cannot be saved for reuse in a different session.

Value

This function returns a vpImage object.

See Also

vpImage

Examples

1
2
3
4
5
filename <- system.file("sample_vid/Walk3.mp4", package = "videoplayR")
vid <- readVid(filename)
imshow(getFrame(vid, 125))
bg <- backgrounder(vid, n = 100, method = "median", color = TRUE)
imshow(bg)

swarm-lab/videoplayR documentation built on May 30, 2019, 9:36 p.m.