Play Video in MATLAB GUI with other Objects
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Bill
el 27 de Ag. de 2011
Respondida: Sk Sahariyaz Zaman
el 28 de Abr. de 2016
Hi, all. I'm starting an experiment where I need to have a video window, as well as a number of text boxes and buttons in a single GUI window. Is this possible? Does anyone have any example code or suggestions on how I might be able to embed the video into the GUI and control it?
Thank you kindly.
Bill
0 comentarios
Respuesta aceptada
Chaowei Chen
el 27 de Ag. de 2011
function main(var_3D)
if nargin<1, var_3D=randn(100,100,100);end
[R,C,Frame]=size(var_3D);
h_play=uicontrol('style','pushbutton','callback',@play_var,'string','play');
h_text1=uicontrol('style','edit','string','edit1','position',[200 20 80 20]);
h_text2=uicontrol('style','edit','string','edit2','position',[300 20 80 20]);
function play_var(hObject,events)
for f=1:Frame
imshow(var_3D(:,:,f));
title(['frame ' int2str(f)]);
drawnow;
end
end
end
2 comentarios
Más respuestas (3)
Chaowei Chen
el 27 de Ag. de 2011
function main
vid = videoinput('winvideo', 1);
figure;
h_play=uicontrol('style','pushbutton','callback',@play_vid,'string','play','position',[200 20 80 20]);
h_stop=uicontrol('style','pushbutton','callback',@stop_vid,'string','stop','position',[300 20 80 20]);
h_img=image;
%%
function play_vid(hObject,events), preview(vid,h_img), end
function stop_vid(hObject,events), stoppreview(vid), end
end
3 comentarios
Chaowei Chen
el 27 de Ag. de 2011
function main
[f,p]=uigetfile('*.avi');cd(p)
h_play=uicontrol('style','pushbutton','callback',@play_vid,'string','play','position',[200 20 80 20]);
function play_vid(hObject,events), winopen(f); end
end
1 comentario
Chaowei Chen
el 27 de Ag. de 2011
This won't put the video window in the GUI. Maybe somebody can help.
Ver también
Categorías
Más información sobre Audio and Video Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!