Skip to contents

Read a specific frame of a Video or VideoStack object and returns it as an Image object.


# S3 method for Rcpp_Video
readFrame(x, pos, target = "new")

# S3 method for VideoStack
readFrame(x, pos, target = "new")

readFrame(x, pos, target = "new")



A Video or VideoStack object.


An integer corresponding to the position of the frame to read in the video or video stack.


The location where the results should be stored. It can take 2 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 will replace the content of target. Note that target must have the same dimensions as x.


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.


Simon Garnier,


balloon <- video(system.file("sample_vid/Balloon.mp4", package = "Rvision"))
#> Error: Could not open the video.
frame10 <- readFrame(balloon, 10)
#> Error in eval(expr, envir, enclos): object 'balloon' not found