how to play videos using implay function in specific axes?

i am trying to play videos in my matlab gui but i couldnt figure out how to play video in my specific axes. plz help me :)

2 commentaires

global videoFReader
faceDetector = vision.CascadeObjectDetector();
videoFReader = vision.VideoFileReader('test.avi');
videoPlayer = vision.VideoPlayer;
while ~isDone(videoFReader)
videoFrame = step(videoFReader);
step(videoPlayer, videoFrame);
end
axes(handles.axes1)
imshow(videoFReader);
% However Videoplayer is not in axes box !!!!
Please help me
global show_video; videoFReader = vision.VideoFileReader('test.mp4'); framert = 30; videoPlayer = vision.VideoPlayer; ax = handles.axes1; % assuming axes1 is used to disply in GUI while ~isDone(videoFReader) videoFrame = step(videoFReader); image(videoFrame, 'Parent', ax); set(ax,'Visible', 'off'); pause(1/framert); if show_video ~=1 % used as global so that can be set at controlling place. if show_video = 1 continuously play break end end release(videoPlayer);

Connectez-vous pour commenter.

 Réponse acceptée

Thomas Koelen
Thomas Koelen le 8 Mai 2015
Modifié(e) : Thomas Koelen le 8 Mai 2015
You have axes in your gui, let's say they are called
axes1
(you can check the name of the axes by double clicking on it in GUIDE, then look for Tag.
Then the only thing you have to do is:
axes(handles.axes1);
implay(videohere);

7 commentaires

yes i tried to do it in the exact same way but its not getting displayed in axes1
videohere='video.mp4'; axes(handles.axes1); implay(videohere);
obj = mmreader('xylophone.mp4');
video = obj.read();
axes(handles.axes1);
fps=30;
for i=1:max(video(1,1,1,:))
imshow(video(:,:,:,i));
pause(1/fps);
end
sloppy fix but it should do the job.
it works!! Thanku :)
if i want to use 'implay', because it takes less time. how can I do?
Not enough memory available for 149423 frames. what can i do with this error? Thank u
Hi, Ive just tried both ways but it doesnt work. Implay always pop new window, I need to have it in the axes in GUI.
how can i use it with 'implay'

Connectez-vous pour commenter.

Plus de réponses (2)

Gabriel Zalles
Gabriel Zalles le 26 Juin 2017
Can I just say? Matlab support is attrocious. I can't believe how little help there is online for problems like this. The company should pay people to go online and provide solutions for people.
Ganesh Raut
Ganesh Raut le 8 Mai 2015
Thomas Koelen..
ur answer not work.. actually play video but not in axes..plz help

4 commentaires

Thomas Koelen
Thomas Koelen le 8 Mai 2015
Modifié(e) : Thomas Koelen le 8 Mai 2015
Check the my comment, this should work.
Attached a gui.
but you have not used 'implay'
Check the my comment, this should work.
No, it doesn't work. It will play in the designated axes, but the use of a for-loop in conjunction with pause gives a very inaccurate frame rate.
global show_video; videoFReader = vision.VideoFileReader('test.mp4'); framert = 30; videoPlayer = vision.VideoPlayer; ax = handles.axes1; % assuming axes1 is used to disply in GUI while ~isDone(videoFReader) videoFrame = step(videoFReader); image(videoFrame, 'Parent', ax); set(ax,'Visible', 'off'); pause(1/framert); if show_video ~=1 % used as global so that can be set at controlling place. if show_video = 1 continuously play break end end release(videoPlayer);

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