play(self,
window=' Input ' ,
pos=None,
delay=20,
annotate=True,
imageBuffer=None,
startframe=0,
endframe=None,
onNewFrame=None,
**kwargs)
| source code
|
Plays the video, calling the onNewFrame function after loading each
frame from the video. The user may interrupt video playback by
hitting (sometimes repeatedly) the spacebar, upon which they are
given a text menu in the console to abort program, quit playback,
continue playback, or step to the next frame.
@param window: The window name used to display the video. If None,
then the video won't be shown, but onNewFrame will be called at
each frame.
@param pos: A tuple (x,y) where the output window should be located
on the users screen. None indicates default openCV positioning algorithm
will be used.
@param delay: The delay in ms between window updates. This allows the user
to control the playback frame rate. A value of 0 indicates that the video
will wait for keyboard input prior to advancing to the next frame. This
delay is used by the pauseAndPlay interface, so it will affect the rate
at which onNewFrame is called as well.
@param annotate: If True, the image will be annotated with the frame number
in the upper left corner. Set false for no frame number annotation.
@param imageBuffer: An optional pyvision ImageBuffer object to contain the
most recent frames. This is useful if a buffer is required for background
subtraction, for example. The buffer contents is directly modified each
time a new image is captured from the video, and a reference to the buffer
is passed to the onNewFrame function (defined below).
@param startframe: If > 0, then the video will cue itself by quickly fast-forwarding
to the desired start frame before any images are shown. During the cueing process,
any _onNewFrame function callbacks (or VideoStreamProcessor objects) will NOT be
activated.
@param endframe: If not None, then the playback will end after this frame has
been processed.
@param onNewFrame: A python callable object (function) with a
signature of 'foo( pvImage, frameNum, key=None, buffer=None )', where key is
the key pressed by the user (if any) during the pauseAndPlay interface, and
buffer is a reference to the optional image buffer provided to the play method.
@param kwargs: Optional keyword arguments that should be passed
onto the onNewFrame function.
@return: The final frame number of the video, or the frame number at which
the user terminated playback using the 'q'uit option.
|