Hi ImageAnalyst,
> It is not necessary to add basic functions which are already
> implemented in Matlab (like VideoReader) to run an executable file.
Ok, but while the executable is running, the Matlab error sound appears if I do not include VideoReader within the executable file. Nevertheless, the algorithm continues to work. Can this be neglected? Or do the programme really having a problem at this point? (I inserted msgboxes after each line to find the position where this problem appears.) The 'sound error' line looks like:
avivid = VideoReader(handles.avifilename);
So it seams that my algorithm always get a problem if I use handles.
> startframehuge(hObject, handles, 1)
> ? Where does it come from?
The program terminates, if I call the function startframehuge(hObject, handles, framenumber) within a pushbutton callback. (If you want to see the code, have a look below below, but as I told you; the call of the function terminates already the program) The function startframehuge read out a video frame (here first frame: framenumber = 1) and write it to the figure element of the GUI. Within the function I use the variable handles to store the filedate.
It was the first GUI, which I developped and I read somewhere, (do not ask me where), that it is usefull to update the GUI parameteres via guidata after each function to avoid a loss of handles. So, i did this.
> Either is required ONLY if you made changes to handles. If you never
> called set() then you don't need to pass back handles or call guidata.
But if I use set I have to pass hObject as well. Otherwise guidata will not work (error 'variable hObect unknown') If I use set() I have to update the handles via guidata. Hence hObject should be included in the function? Or am I wrong?.
Thanks for help
Sebastian
function browsePushbutton_Callback(hObject, eventdata, handles)
%...
global avivid;
[avifilename avifilepath] = uigetfile('*.avi','avi-video');
handles.avifilename = avifilename;
handles.avifilepath = avifilepath;
...
addpath(handles.avifilepath);
avivid = VideoReader(handles.avifilename);
set(handles.activex1,'URL',[handles.avifilepath handles.avifilename]);
...
startframehuge(hObject, handles, 1)
...
guidata(hObject, handles);
function startframehuge(hObject, handles, framenumber)
% Displays the first frame of the chosen avi-file.
%
%
% (c) Copyright Sebastian Dittmar
global avivid
global oneframe
hmsgbox=msgbox('2','ok','help');
uiwait(hmsgbox);
mov(framenumber).cdata = read(avivid, framenumber);
handles.firstframe = double(mov(framenumber).cdata(:,:,2));
oneframe = subplot('position',[0 0.05 1 0.9]);
imagesc(handles.firstframe);
hold on;
title(['Frame ' num2str(framenumber)]);
axis 'equal';
set(gca,'XTick',[]);
set(gca,'XTickLabel',[]);
set(gca,'YTick',[]);
set(gca,'YTickLabel',[]);
colormap 'gray';
hold off;
pause(0.1);
if(str2double(get(handles.numberframesEdit,'String'))~=1)
set(handles.actualframeText,'String',['Frame: ' num2str(framenumber)]);
else
set(handles.actualframeText,'String','');
end
guidata(hObject, handles);