www.gusucode.com > vision 源码程序 matlab案例代码 > vision/PlayAVideoFromAFileExample.m

    %% Play a Video From a File
% Set up System objects to read and view a video file.

% Copyright 2015 The MathWorks, Inc.

videoFReader   = vision.VideoFileReader('atrium.mp4');
depVideoPlayer = vision.DeployableVideoPlayer;
%%
% Continue to read frames of video until the last frame is read. Exit the loop if user closes the video player window.
cont = ~isDone(videoFReader);
  while cont
    frame = step(videoFReader);
    step(depVideoPlayer, frame);   
    cont = ~isDone(videoFReader) && isOpen(depVideoPlayer);
  end
%%
% Release System objects.
release(videoFReader);
release(depVideoPlayer);