[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Proposed Module: Camera



Thanks!  I added it to the version in my repo.  I didn't realize there
was that much of a performance gain to be had.  That probably explains
why it was a bit slow on the OLPC.

Just a note:  Camera.query_image() doesn't work properly on all
cameras.  I just got the pixelformat for the somewhat supported cheap
Rocketfish webcam I have working, and so I've been using it for
testing.  It seems that the driver will not actually queue a frame
unless presented with a blocking call like in get_image().  The vivi
driver acts the same way.  I may have to think of a different way to
make this non-blocking.

As of the current revision at
http://git.n0r.org/?p=pygame-nrp;a=summary there are several new
functions and additional pixelformat support:

There is preliminary camera controls support, with horizontal and
vertical flip for now.  This could save CPU time by not having to
mirror the Surface later, but not all cameras support it.

There is a function to return the size of images being captured, to
prevent having to capture a Surface and checking the size on that to
know what the camera is doing.

There is now support for YUV420, Bayer8, and RGB565 cameras, which
along with YUYV and RGB24, should cover just about every v4l2 driver
around.  Though, currently Bayer8 and RGB565 need some debugging.

For now, I'm pretty much done with what I had planned for the Camera
module, after I debug the remaining pixelformat conversions.  I'm
going to continue to the second part of my GSoC project, which was
writing some basic computer vision functions for use with this.

Nirav Patel

On Fri, Jun 13, 2008 at 10:39 PM, René Dudfield <renesd@xxxxxxxxx> wrote:
> hello,
>
> I tried out your camera code on my linux laptop... nice work!
>
> I also tried Michaels demo - quite fun indeed!  not just for kids either...
>
>
> A couple of notes...
>
>
> You could supply a surface to get_image()
>
> cam.get_image(destination_surface)
>
> Much like the transform.scale, and a few other functions do.  This
> means that you don't need to keep allocating memory each time - which
> turns out to save a lot of time.
>
> I'ved modified your camera.c file:
> http://rene.f0o.com/~rene/stuff/camera.c
>
> also modified Michaels demo to reuse the surface:
> http://rene.f0o.com/~rene/stuff/camera.py
>
>
>
>
> cheers,
>
>
>
>
>