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

[pygame] Proposed Module: Camera



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