Raspberry Pi camera 101

139 views Asked by At

After reading PiCamera documentation, couple of questions have come to my mind that I might need some help to be able to answer them?

enter image description here

Does Pi uses lossy compression or lossless compression?

Is data really copy to RAM as many times as shown in the picture?

Is compression happening frame by frame and within the frame?

Are we duplicating RAM or using same buffer in step 3,4,5 and 6?

In scenarios where a circular buffer is created (using PiCameraCircularIO class), how is the picture shown above affected?

Thanks in advance!

1

There are 1 answers

0
Markus Schumann On

The Pi uses lossy compression.

When the image enters the camera its colors are limited to the specified color-space. This may be as little as 50% of what the human eye can see.

Then the camera scales the color information to 25% (or throws away 75%) commonly referred to 4:2:0.

Now the already massively shrunk image stream gets lossy compressed by H.264 or JPEG compressor.

JPEG does within the frame compression (intra frame). H.264 does frame by frame and within the frame (intra frame and inter frame) You can configure H.264 to do only intra frame - then you create all I-frames.

Frames are processed and changed in step 3 (some signal processing) and step 5 (H.264 compression) so it must use different memory in 3 and 5.

Step 4 and 6 shouldn't be copy if done right.

PiCameraCircularIO should be copy - since the GPU memory can be limited and would overflow if your circular buffer gets to big.