Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
preview video on different axes

Subject: preview video on different axes

From: Ashar

Date: 17 Apr, 2010 01:09:05

Message: 1 of 4

i create program using matlab GUI, the purpose is to show live video from webcam... my GUI has two different axis, one to display video using preview(vid,hImage); and the other one to display histogram. but the preview appear randomly between axes1 and axes2. does anybody know how to control video preview ?

I tried handles.axes1; to get control of axes1, but it has no effect against preview(vid,hImage);

Subject: preview video on different axes

From: Eladi

Date: 13 May, 2010 19:54:20

Message: 2 of 4

"Ashar " <zero_fauzi@yahoo.com> wrote in message <hqb1nh$9mv$1@fred.mathworks.com>...
> i create program using matlab GUI, the purpose is to show live video from webcam... my GUI has two different axis, one to display video using preview(vid,hImage); and the other one to display histogram. but the preview appear randomly between axes1 and axes2. does anybody know how to control video preview ?
>
> I tried handles.axes1; to get control of axes1, but it has no effect against preview(vid,hImage);

Hi!! You can control the axes using this instruction:
hImage = image(zeros(vidRes(2),vidRes(1), nBands),'Parent',handles.axes1);
preview(vid, hImage);

Subject: preview video on different axes

From: Ashar

Date: 13 May, 2010 23:10:22

Message: 3 of 4

thank you for your reply

Subject: preview video on different axes

From: Craig

Date: 6 Jan, 2011 22:55:07

Message: 4 of 4

"Eladi " <ehp4987@telefonica.net> wrote in message <hshldb$qo5$1@fred.mathworks.com>...
> "Ashar " <zero_fauzi@yahoo.com> wrote in message <hqb1nh$9mv$1@fred.mathworks.com>...
> > i create program using matlab GUI, the purpose is to show live video from webcam... my GUI has two different axis, one to display video using preview(vid,hImage); and the other one to display histogram. but the preview appear randomly between axes1 and axes2. does anybody know how to control video preview ?
> >
> > I tried handles.axes1; to get control of axes1, but it has no effect against preview(vid,hImage);
>
> Hi!! You can control the axes using this instruction:
> hImage = image(zeros(vidRes(2),vidRes(1), nBands),'Parent',handles.axes1);
> preview(vid, hImage);

Hello,

I was having a similar problem, and I tried your code. It works perfectly in that the preview works fine. However, when I try to close the figure, I get the following error:

??? Error using ==> get
Invalid handle object.

Error in ==> movegui at 115
oldposmode =
get(fig,'activepositionproperty');

Error in ==> openfig at 109
        movegui(fig(n), 'onscreen');

Error in ==> gui_mainfcn>local_openfig at
286
    gui_hFigure = openfig(name, singleton,
    visible);

Error in ==> gui_mainfcn at 234
            gui_hFigure =
            local_openfig(gui_State.gui_Name,
            'reuse',gui_Visible);


It seems that the preview is still trying to update the figure, even though I have a custom CloseRequestFcn, which runs the stoppreview() function, which should stop the preview from asking for any more updates. If I get rid of the close(gcbo) line at the end of the CloseRequestFcn, I can see that the figure does, in fact, stop updating. Any ideas? Thanks a ton.

Ashar: Did you have this problem?

Tags for this Thread

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.

Contact us