Raspberry Pi camera RAW image acquisition with Python

The PiCamera Python module acquires RAW Bayer masked data from the color Raspberry Pi camera module. Getting raw Bayer images from the camera into 2592x1944 pixels for the V1 camera, 3280x2464 for the V2 camera requires a program as simple as:

#!/usr/bin/env python

import picamera
import picamera.array

with picamera.PiCamera() as cam:
    with picamera.array.PiBayerArray(cam) as stream:
        cam.capture(stream, 'jpeg', bayer=True)
        img = stream.array    

Python code for Raspberry Pi camera Bayer non-demasked image

Time to first image

It takes several seconds to load and process the first image, perhaps following images could occur faster.


Leave a Comment