How can I get MATLAB to play a video without delay?

2 vues (au cours des 30 derniers jours)
Evan L
Evan L le 22 Fév 2016
Commenté : Walter Roberson le 22 Fév 2016
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

Réponses (1)

Matthew Eicholtz
Matthew Eicholtz le 22 Fév 2016
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 commentaire
Walter Roberson
Walter Roberson le 22 Fév 2016
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.)

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by