Thread Subject:
getsnapshot works very slow

Subject: getsnapshot works very slow

From: Ollie chen

Date: 24 May, 2012 02:46:08

Message: 1 of 3

hi guys...

I design my GUI using vb...

when clicked, it calls Matlab and do getsnapshot

but the command "getsnapshot" works quite slow

it takes near 5 seconds to execute

when I do this in Matlab, it only takes less than 1 second

so is there anything I can do to improve the speed ??

many thanks

below is part of my VB code ...

        Dim MatLab As Object
        MatLab = CreateObject("Matlab.Application")
        Dim h As Object
        h = GetObject(, "matlab.application")
        h.Execute("vid1 = videoinput('winvideo',2)")
        h.Execute("set(vid1, 'ReturnedColorspace', 'RGB')")

        Dim dteStart As DateTime = Now
        h.Execute("img=getsnapshot(vid1)")
        Dim TS As TimeSpan = Now.Subtract(dteStart)
        MsgBox("completed?" & TS.TotalSeconds)

Subject: getsnapshot works very slow

From: Steven_Lord

Date: 24 May, 2012 13:52:44

Message: 2 of 3



"Ollie chen" <olliekr@gmail.com> wrote in message
news:jpk7dg$ibq$1@newscl01ah.mathworks.com...
> hi guys...
>
> I design my GUI using vb...
>
> when clicked, it calls Matlab and do getsnapshot
>
> but the command "getsnapshot" works quite slow
>
> it takes near 5 seconds to execute
>
> when I do this in Matlab, it only takes less than 1 second
>
> so is there anything I can do to improve the speed ??

Try adding a semicolon at the end of your h.Execute command to suppress the
display?

h.Execute("img=getsnapshot(vid1);")

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: getsnapshot works very slow

From: Ollie chen

Date: 25 May, 2012 03:04:25

Message: 3 of 3

after suppressing the display

it runs just as fast as in MATLAB

sorry I didn't notice that I forgot to add semicolon

thanks for the reminding !

"Steven_Lord" <slord@mathworks.com> wrote in message <jplefc$ogh$1@newscl01ah.mathworks.com>...
>
>
> "Ollie chen" <olliekr@gmail.com> wrote in message
> news:jpk7dg$ibq$1@newscl01ah.mathworks.com...
> > hi guys...
> >
> > I design my GUI using vb...
> >
> > when clicked, it calls Matlab and do getsnapshot
> >
> > but the command "getsnapshot" works quite slow
> >
> > it takes near 5 seconds to execute
> >
> > when I do this in Matlab, it only takes less than 1 second
> >
> > so is there anything I can do to improve the speed ??
>
> Try adding a semicolon at the end of your h.Execute command to suppress the
> display?
>
> h.Execute("img=getsnapshot(vid1);")
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

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
getsnapshot slow v... Ollie chen 23 May, 2012 22:49:11
rssFeed for this Thread

Contact us