How can I get MATLAB to play a video without delay?
2 次查看(过去 30 天)
显示 更早的评论
I want MATLAB to display and start a video right away. Timing is important for me. The implay() function brings up a GUI that the video can be started in but how do I get the video to start automatically?
Evan
0 个评论
回答(1 个)
Matthew Eicholtz
2016-2-22
Assuming you have the Computer Vision System Toolbox, you can use VideoFileReader and VideoPlayer objects.
doc vision.VideoPlayer
Use the step method to get the next frame from the reader as well as to send the frame to the player.
reader = vision.VideoFileReader('tilted_face.avi');
player = vision.VideoPlayer;
while ~isDone(reader)
frame = step(reader); %get the next frame in the video
step(player,frame); %show the frame
end
release(reader);
release(player);
1 个评论
Walter Roberson
2016-2-22
Note that it will take time to create the reader and player objects. However, you are not required to output any data to the player until you are ready with your other timing. (I have not used the player myself; it might turn out to be advisable to output a frame of zeros first thing until you are ready to actually display frames.)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!