Play video or display image
VideoPlayer object can play a video or
display image sequences.
If you own the MATLAB® Coder™ product, you can generate C
or C++ code from MATLAB code in which an instance of this system
object is created. When you do so, the scope system object is automatically
declared as an extrinsic variable. In this
manner, you are able to see the scope display in the same way that
you would see a figure using the
Starting in R2016b, instead of using the
videoPlayer = vision.VideoPlayer returns
a video player object,
videoPlayer, for displaying
video frames. Each call to the
step method displays
the next video frame.
videoPlayer = vision.VideoPlayer( configures
the video player properties, specified as one or more name-value pair
arguments. Unspecified properties have default values.
Define and set up your video player object using the constructor.
step method with the video
VideoPlayer, and any optional properties.
See the syntax below for using the
step(videoPlayer,I) displays one grayscale
or truecolor RGB video frame,
I, in the video
Caption display on video player window
Specify the caption to display on the video player window as a character vector.
Size and position of the video player window in pixels
Specify the size and position of the video player window in
pixels as a four-element vector of the form:
Default: Dependent on the screen resolution. Window positioned in the center of the screen with size of 410 pixels in width by 300 pixels in height.
|hide||Turn figure visibility off|
|isOpen||Visible or hidden status for video player figure|
|reset||Reset displayed frame number to zero|
|show||Turn figure visibility on|
|step||Play video or image sequence|
|Common to All System Objects|
Create System object with same property values
Expected number of inputs to a System object
Expected number of outputs of a System object
Check locked states of a System object (logical)
Allow System object property value changes
Read video from a file and set up player object.
videoFReader = vision.VideoFileReader('viplanedeparture.mp4'); videoPlayer = vision.VideoPlayer;
Play video. Every call to the
step method reads another frame.
while ~isDone(videoFReader) frame = step(videoFReader); step(videoPlayer,frame); end
Close the file reader and video player.