Queue-class | R Documentation |
A Queue
object contains a self-filling, asynchronous
queue of images retrieved from a Video
or Stream
object. Retrieving an image from a video or camera stream is generally fast
but it still comes with a time penalty that can become significant when
processing large numbers of images and/or videos. A Queue
object can
help save some of that lost time by reading and storing images from a video
or stream in parallel of the main R thread, for instance while other
operations are being performed by R on previously read images. These
pre-loaded frames are, therefore, immediately available when needed,
effectively eliminating the wait time between two frame reads (as long as
the queue reads and stores new frames faster than R can process them).
Function for creating Queue
objects for
Video
and Stream
objects.
queue(x, size = 10, delay = 1000, overflow = "pause")
x |
Either a |
size |
The number of frames that the |
delay |
Time in microseconds between two queue updates (default: 1000). Increasing the delay will slow down the speed at which the queue fills up. Decreasing it will fill up the queue faster but will use up more processing resources. |
overflow |
A character string indicating what the
|
A Queue
object.
dim,ncol,nrow
Functions returning the dimensions of the frames in the queue.
length
Function returning the number of frames in the queue.
capacity
Function returning the maximum number of frames that the queue can hold at any one time.
frame
Function returning the index of the frame to be read next.
full,empty
Function returning the state of the queue (full or empty or neither).
readNext
Function to access the next frame in the queue.
reset
Function to empty the queue and start collecting new frames.
Simon Garnier, garnier@njit.edu
queue
, Video
, Stream
balloon <- video(system.file("sample_vid/Balloon.mp4", package = "Rvision"))
buf <- queue(balloon)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.