|
"Alric Gta" <alric2rei@yahoo.com> wrote in message <h1qape$8ce$1@fred.mathworks.com>...
>
> Hi,
>
> I extract a frame from a video file
>
> function extract_Callback(hObject, eventdata, handles)
>
> film=mmreader('mymovie.avi');
> poza=read(film,20); % extract the frame(20) in variable "poza"
>
> poza=imresize(poza,[480 640]); % do a resize
>
> axes(handles.axes1);
> imshow(poza); % show image
>
> handles.img=poza; % transfer the image in variable handles.img
> figure,imshow(handles.img); % is working
>
> guidata(hObject,handles)
>
> %%%============================================
>
> function show_Callback(hObject, eventdata, handles)
> % hObject handle to pushbutton5 (see GCBO)
> % eventdata reserved - to be defined in a future version of MATLAB
> % handles structure with handles and user data (see GUIDATA)
>
> I=handles.img; % put the image in variable I
>
> figure,imshow(I); % not working
> guidata(hObject,handles)
>
>
>
> I keep getting this err:
>
> ??? Reference to non-existent field 'img'.
>
> Error in ==> myvid>show_Callback at 179
> I=handles.img;
>
> Error in ==> gui_mainfcn at 96
> feval(varargin{:});
>
> Error in ==> myvid at 42
> gui_mainfcn(gui_State, varargin{:});
>
> Error in ==> @(hObject,eventdata)myvid('show_Callback',hObject,eventdata,guidata(hObject))
>
>
> ??? Error while evaluating uicontrol Callback
>
> I have OS: Win XP ======> Matlab 2008b
>
> Thanks
Hi,
first get the handles of GUI ("handles = guidata(hObject);") &
update the handle with your image(handles.img=poza) then,
In the other callback
first get the updated handles & get your image back,
handles = guidata(hObject);
I=handles.img
I am not sure weather your code will work fine in the first call back itself,
the output of read command will be 4 dimentional...imresize & imshow (4 dimention variable) may not work.
Shan.....
|