In python module picamera, does anyone noticed that camera.capture(array, 'rgb') is quite slow?? If you try to measure this time is about 540ms...

example code (the "real code" is irrelevant):

from picamera import PiCamera
import numpy as np
from time import sleep

camera = PiCamera()
camera.resolution = (320, 240)
camera.framerate = 24
output = np.empty((240, 320, 3), dtype=np.uint8)
camera.capture(output, 'rgb')

Then I use the output object to render a QWidget There is a faster way to do it?? I want something to about 16ms latency.


Finally, I've managed to do it, basically, I have used the underlying MMAL object to get the input directly. Now I have maximum framerate while rendering of 45ms, which is almost real-time for my needs. I think it's possible to go lower by changing the format.

from picamera import mmal, mmalobj as mo
from time import sleep

def image_callback(port, buf):
    return False

camera = mo.MMALCamera()
preview = mo.MMALRenderer()

camera.outputs[0].framesize = (320, 160)
camera.outputs[0].framerate = 30
camera.outputs[0].format = mmal.MMAL_ENCODING_RGB24


sleep (10)


usefull link: https://picamera.readthedocs.io/en/release-1.13/api_mmalobj.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.