[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Proposed Module: Camera
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Proposed Module: Camera
- From: "René Dudfield" <renesd@xxxxxxxxx>
- Date: Fri, 30 May 2008 16:06:54 +1000
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Fri, 30 May 2008 02:07:02 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=VUgdg0/Xi7qN90ftlLXD1c2WAGhs0TTXmSODIp19ADQ=; b=N9lDyuRzTFzvFUVaSbovSWQObKeHn4bBONJm5ovAs3tOjtUejkD0Ar6Vx165YAipIPV8z9sq+HGHXXTdaTPVrxkM6EnJiitrFnV6gvKvqcb5wNAJkYug1jBmY+v3OoQWgALU/DO2bHy3BKwIdSPXfpUaNmh9oSvrUF3yO4D6s4U=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=kegMwJXOq7a60eWCPUq0rgiy0Mmy237y3Q+S7qGIiHcUrc5m3Livg0umOJcHxh4myK/ycyefTgR5UpPvn3p2JKjbbzFsEEH/XM2xKtZfg3vfzdoYEGBARNnxkdwiimkTDDwuZ7T/pixLT146m5G6tro173VSnKU9WuHAkS7RUHo=
- In-reply-to: <a7215bb70805262222y6ec63f84xd1ca5463032434af@xxxxxxxxxxxxxx>
- References: <a7215bb70805262222y6ec63f84xd1ca5463032434af@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
hi,
a few notes...
> The basic plan is to use V4L2_MEMORY_MMAP, mmap() the image buffer,
> and convert the image to RGB24 (if it isn't already) as a Surface.
I like that idea.
*- it needs multiple camera support.
So make it create a camera object.
For example:
a_camera = camera.Camera(device, width, height)
a_camera.get_image()
*- you could try implementing your api with the opencv python wrapper.
This way you could start adding tests early on.
*- since many cameras are low frame rate, it would be nice if there
were events emitted for things like FRAME_AVAILABLE.
eg. if a camera is 10fps then it'd be good if the get image call
didn't block - so then the rest of the program can run faster.
This could require buffering of frames. Perhaps in a separate thread.
Or maybe there could be a blocking call, and the rest is left up to the user.
What do you think is a good way to handle blocking?
Also I think some cameras require you to get the image data at a
certain frequency... otherwise an internal buffer overflows or
something. This has been my experience with opencv anyway.
*- Some way to query camera capabilities?
On Tue, May 27, 2008 at 3:22 PM, Nirav Patel <olpc@xxxxxxxxxxxxxx> wrote:
> Hello all,
>
> I'd like to propose a pygame module to enable camera support.
> Specifically, v4l2 support with the eventual possibility of v4l and
> vfw. I realise having only v4l2 to start with limits it to linux, but
> its a start. It will consist of the following functions.
>
> camera.open(device, width, height)
> camera.start()
> camera.getimage() returns Surface
> camera.stop()
> camera.close()
>
> The parameters for open are intentionally simple. Similar to
> libraries like OpenCV, it will negotiate with the v4l2 drivers to pick
> an acceptable pixel format. At least to start with, the supported
> pixel formats would be the most common ones like RGB3 (RGB24), R444
> (RGB444), YUYV, and others that people want.
>
> The basic plan is to use V4L2_MEMORY_MMAP, mmap() the image buffer,
> and convert the image to RGB24 (if it isn't already) as a Surface.
>
> Nirav Patel
>