camera
– Support for camera input
The camera
module contains classes to control the camera and take pictures.
Available on these boards
- class camera.Camera
The class to control camera.
Usage:
import board import sdioio import storage import camera sd = sdioio.SDCard( clock=board.SDIO_CLOCK, command=board.SDIO_COMMAND, data=board.SDIO_DATA, frequency=25000000) vfs = storage.VfsFat(sd) storage.mount(vfs, '/sd') cam = camera.Camera() buffer = bytearray(512 * 1024) file = open("/sd/image.jpg","wb") size = cam.take_picture(buffer, width=1920, height=1080, format=camera.ImageFormat.JPG) file.write(buffer, size) file.close()
Initialize camera.
- take_picture(buf: circuitpython_typing.WriteableBuffer, format: ImageFormat) int
Take picture and save to
buf
in the givenformat
. The size of the picture taken iswidth
byheight
in pixels.- Returns:
the number of bytes written into buf
- Return type:
- class camera.ImageFormat
Image format
Enum-like class to define the image format.
- JPG: ImageFormat
JPG format.
- RGB565: ImageFormat
RGB565 format.