How coding to read avi files, take every frame and save it back in the variable mov1 on a GUI?

1 view (last 30 days)
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);

Accepted Answer

Geoff Hayes
Geoff Hayes on 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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!