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

3 Ansichten (letzte 30 Tage)
Evan L
Evan L am 22 Feb. 2016
Kommentiert: Walter Roberson am 22 Feb. 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

Antworten (1)

Matthew Eicholtz
Matthew Eicholtz am 22 Feb. 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 Kommentar
Walter Roberson
Walter Roberson am 22 Feb. 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.)

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by