Thread Subject: Doesn't pass the value

Subject: Doesn't pass the value

From: Alric Gta

Date: 23 Jun, 2009 10:29:02

Message: 1 of 3


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

Subject: Doesn't pass the value

From: Shanmugam Kannappan

Date: 23 Jun, 2009 10:57:01

Message: 2 of 3

"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.....
 

Subject: Doesn't pass the value

From: Alric Gta

Date: 23 Jun, 2009 12:09:02

Message: 3 of 3

"Shanmugam Kannappan" <shanmugambe@gmail.com> wrote in message <h1qcdt$qvu$1@fred.mathworks.com>...
> "Alric Gta" <alric2rei@yahoo.com> wrote in message <h1qape$8ce$1@fred.mathworks.com>...

> 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.....
>

Still doesn't work

In matlab v7.1 to transfer the value of a variable from a function to another function in the same script I was doing it with

handles.name_of_variable

 but in matlab v7.7 (2008b) doesn't work.

WHY ??

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
mmreader Sprinceana 23 Jun, 2009 08:05:50
video Sprinceana 23 Jun, 2009 08:05:50
2 functions Sprinceana 23 Jun, 2009 07:30:44
pass values bet... Sprinceana 23 Jun, 2009 07:30:44
rssFeed for this Thread

Contact us at files@mathworks.com