How coding to read avi files, take every frame and save it back in the variable mov1 on a GUI?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Geoff Hayes
2016-3-5
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!