How coding to read avi files, take every frame and save it back in the variable mov1 on a GUI?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Marquel Dwi Putranto
il 3 Mar 2016
Commentato: Marquel Dwi Putranto
il 6 Mar 2016
readerobj = mmreader('AC (1).avi','tag','myreader1')
vidFrames = read (readerobj);
numFrames = get (readerobj, 'numberOfFrames');
h = waitbar(0,'Tunggu sebentar sedang proses...');
for k = j : numFrames
waitbar (k/numFrames,h)
f = vidFrames(:,:,:,k);
mov1(k).cdata = f;
mov1(k).colormap = [];
end
waitbar(1,h)
hf1 = figure (1);
set(hf1);
0 Commenti
Risposta accettata
Geoff Hayes
il 5 Mar 2016
Marquel -please describe how the above code is used within with respect to your GUI. Do you have a push button that loads the media from the avi file? Have you used GUIDE to create your GUI? If so, then just save mov1 to the handles structure of the callback that launched the above
% function to load the AVI media
function pushbutton1_Callback(hObject, eventdata, handles)
readerobj = mmreader('AC (1).avi','tag','myreader1')
vidFrames = read (readerobj);
numFrames = get (readerobj, 'numberOfFrames');
h = waitbar(0,'Tunggu sebentar sedang proses...');
for k = j : numFrames
waitbar (k/numFrames,h)
f = vidFrames(:,:,:,k);
mov1(k).cdata = f;
mov1(k).colormap = [];
end
waitbar(1,h);
% save the mov1 variable to handles
handles.mov1 = mov1;
guidata(hObject,handles);
We use guidata to store the media to the handles structure so that all other callbacks or functions from within your GUI have access to it.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Printing and Saving in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!