Webcams and python

2007-03-17 Thread Synt4x
I'm using VideoCapture in windows to obtain images from my webcam. The
thing is, if i want to show a live video from my webcam i have to make
an infinite loop and request an image everytime:

from VideoCapture import Device
cam = Device()

while 1:
img = cam.getImage()

Now, by doing this, my processor fires up to 100% load, which
obviously makes my pc useless.

Is there any way or algorithm to lower the cpu load?

Thx.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Webcams and python

2007-03-18 Thread Synt4x
On 18 mar, 04:24, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> In <[EMAIL PROTECTED]>, Synt4x wrote:
> > from VideoCapture import Device
> > cam = Device()
>
> > while 1:
> > img = cam.getImage()
>
> > Now, by doing this, my processor fires up to 100% load, which
> > obviously makes my pc useless.
>
> > Is there any way or algorithm to lower the cpu load?
>
> Just throw a small `time.sleep()` into the loop.
>
> Ciao,
> Marc 'BlackJack' Rintsch

The problem with adding a sleep() instrucction is that the "video
feed" looks lagged, if you know what I mean. It looks interrupted.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Webcams and python

2007-03-18 Thread Synt4x
On 18 mar, 14:17, "sturlamolden" <[EMAIL PROTECTED]> wrote:
> On Mar 18, 3:41 pm, "Synt4x" <[EMAIL PROTECTED]> wrote:
>
> > The problem with adding a sleep() instrucction is that the "video
> > feed" looks lagged, if you know what I mean. It looks interrupted.
>
> You could try win32api.Sleep(0) instead, which will release the
> reminder of the time slice.

I haven't been able to find the win32api extension, but i've read on
the web that time.sleep() calls win32api.Sleep().

-- 
http://mail.python.org/mailman/listinfo/python-list


Mouse click in python

2007-03-30 Thread Synt4x
I'm creating a webcam user interface (to control google earth through
my webcam) and I still can't find a good example to how to control the
mouse to "click and drag" (not just click and release). I want to move
an object in front of the webcam and move maps on google earth.

I hope someone understands what i need.

-- 
http://mail.python.org/mailman/listinfo/python-list