waveform80 / picamera

A pure Python interface to the Raspberry Pi camera module
https://picamera.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.57k stars 355 forks source link

Stale old images delivered on capture() #681

Open dronus opened 3 years ago

dronus commented 3 years ago

When using capture() with an PiRGBArray (using 'bgr' format, not sure if that matters), on the long term stale images are delivered. Sometimes the is an exception on the capture call (io error, maybe caused by bad wiring) before.

On subsequent calls, capture() delivers a frame that is taken at the last call before.

This may stack up, eg. capture() deliver frames taken at two calls ago or maybe even more. But two happens for sure.

So there seems to be some FIFO buffering that is not properly flushed if the frame is not delivered eg. by an exception happening. So the next time capture() is called, it just triggers the camera again and adds another frame to this buffer, and then delivers the older one.