필터 지우기
필터 지우기

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

조회 수: 1 (최근 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);

채택된 답변

Geoff Hayes
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 CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by