![]() pygame documentation |
||
Pygame Home ||
Help Contents ||
Reference Index ||
Camera || Cdrom || Color || Cursors || Display || Draw || Event || Font || Image || Joystick || Key || Mask || Mixer || Mouse || Movie || Music || Overlay || Pixelarray || Pygame || Rect || Scrap || Sndarray || Sprite || Surface || Surfarray || Time || Transform |
pygame.camera.colorspace - Surface colorspace conversion | Surface colorspace conversion |
pygame.camera.list_cameras - returns a list of available cameras | returns a list of available cameras |
pygame.camera.Camera - load a camera | load a camera |
Pygame currently supports only v4l2 cameras.
Allows for conversion from "RGB" to a destination colorspace of "HSV" or "YUV". This is useful for computer vision on devices with limited processing power. Capture as small of an image as possible, transform.scale() it even smaller, and then convert the colorspace to YUV or HSV before doing any processing on it.
Checks the computer for available cameras and returns a list of strings of camera names, ready to be fed into pygame.camera.Camera.
Camera.start - opens, initializes, and starts capturing | opens, initializes, and starts capturing |
Camera.stop - stops, uninitializes, and closes the camera | stops, uninitializes, and closes the camera |
Camera.get_controls - gets current values of user controls | gets current values of user controls |
Camera.set_controls - changes camera settings if supported by the camera | changes camera settings if supported by the camera |
Camera.get_size - returns the dimensions of the images being recorded | returns the dimensions of the images being recorded |
Camera.query_image - checks if a frame is ready | checks if a frame is ready |
Camera.get_image - captures an image as a Surface | captures an image as a Surface |
Camera.get_raw - returns an unmodified image as a string | returns an unmodified image as a string |
Loads a v4l2 camera. The filename is typically something like "/dev/video0". Default width and height are 640 by 480. Format is the desired colorspace of the output. This is useful for computer vision purposes. The following are supported:
Opens the camera device, attempts to initialize it, and begins recording images to a buffer.
Stops recording, uninitializes the camera, and closes it.
If the camera supports it, get_controls will return the current settings for horizontal and vertical image flip as bools. If unsupported, it will return the default values of (0, 0). Note that the return values here may be different than those returned by set_controls.
Allows you to change camera settings if the camera supports it. The return values will be the input values if the camera claims it succeeded or the default values if not. Note that the actual settings being used by the camera may not be the same as those returned by set_controls.
Returns the current dimensions of the images being captured by the camera.
If an image is ready to get, it returns true. Otherwise it returns false. Note that some webcams will always return False and will only queue a frame when called with a blocking function like get_image().
Pulls an image off of the buffer as an RGB Surface. It can optionally reuse an existing Surface to save time.
Gets an image from a camera as a string in the native pixelformat of the camera. Useful for integration with other libraries.