Open scriptorron opened 1 year ago
Hi, thanks for the question. We're probably getting caught out by the camera rotation. Raspberry Pi cameras are all actually mounted upside down on the camera boards, so libcamera automatically applies a 180 degree rotation to undo this effect and turn the images the right way up. For some sensors - including all the Raspberry Pi ones - this rotates the Bayer pattern (e.g. BGGR becomes RGGB).
Whenever you request a raw image format, the Bayer order is in fact ignored, because you have no choice in the matter. It may take heed of the bit depth you attach (depending on what is available), and also whether you want packed or unpacked raw data. But it always just sets the Bayer order to the one and only permutation that is valid. Does that help?
I understand the effect of the camera rotation. In the new picamera2 version the Rotation
property has changed from 180 to 0, but the data array still has the same orientation and Bayer pattern as in the version before.
Half year ago (older version of picamera2) I spend some time to find out the Bayer pattern in the data array. Picamera2 reported for the V1 camera the properties GBRG and Rotation 0. With experiments I proved the GBRG order in the data array. The HQ camera had properties RGGB and Rotation 180. Experiments shown a BGGR order in the data array. That made sense to me because a 180 degree rotation of RGGB makes BGGR.
With the new picamera2 version the HQ camera has properties RGGB and Rotation 0. But data is still BGGR. In contrast the V1 camera still has properties GBRG, Rotation 0 and data is still GBRG (I tried it right now).
Both cameras have now the same Rotation value. But for HQ I need to rotate the Bayer pattern (or the data array), for V1 not. The properties ColorFilterArrangement
and Rotation
are not enough to tell what the Bayer pattern in the data is. Likely this is not what you intended.
There was a recent-ish change down in libcamera itself where the meaning of the rotation property was changed. I believe that's going to be (possibly has been, in some repositories) changed back because it wasn't correct. But you should always be able to tell the correct Bayer format by looking at picam2.camera_configuration()['raw']['format']
, I believe.
Thank you very much!
For HQ camera the picam2.camera_configuration()['raw']['format']
reports 'SBGGR12_CSI2P' while picam2.sensor_modes
for same resolution and binning says 'SRGGB12_CSI2P'. That's a little bit confusing. But now I know which one relevant and I will change my software to look on the right one.
Many thanks for your quick and great support! If you like you can close this issue.
For official HQ camera the camera properties report "RGGB" Bayer pattern (ColorFilterArrangement 0). The format names for the raw modes also start with "SRGGB". But HQ camera seems to have BGGR Bayer pattern (ColorFilterArrangement 3).
To Reproduce To show camera properties and raw modes:
Console Output
Expected behaviour 'ColorFilterArrangement': 2
Hardware : Pi 3 and Pi 4
Additional context "Debian GNU/Linux 11 (bullseye)"
libcamera and picamera2 installed with
apt
from distribution repositories: