So some progress has been made since the previous post about the cameras in the PinePhone
The previous post had the camera scripts running on the 5.6 kernel which only supported the ov5640 rear camera. Now I've build a kernel with 5.7 and megi's camera patches on top. This enables the front camera (gc2145) because by default the camera module for the Allwinner A64 doesn't support multiple cameras on the same bus.
The patches also make the kernel support more modes for the camera in the correct way and disable some denoising and sharpening in the rear camera, which improves the image quality.
Post processing the raw photos takes some time but gives way sharper results. In my case I used the bayer2rgb tool to convert the raw images to debayered rgb images with a tiff header, then I used Darktable to give the image better colors, contrast, sharpness and some denoising. To make this workflow better the sensor data would need to be profiled against a color chart to make a better transformation from the raw data to image colors.
Here's a comparison between the same photo taken in UYVY mode with the latest kernel and a photo taken in raw mode and postprocessed:
Also important to note: these photo's aren't just bleak because the sensor, it has also been raining all day.
The commands used to make these images:
$ camera.py still rear.raw -c rear -r 1080p1 --raw --pixfmt
$ bayer2rgb -i rear.raw -w 1920 -v 1080 -b 8 -f BGGR -t -o rear.tiff
$ darktable rear.tiff
Front camera
The front camera is still in pretty rough shape... but it does work!
As you can see above, the image quality isn't great. Auto whitebalance isn't working at all causing the image to be very green. The auto-exposure is also not working correctly causing it to overexpose most images.
The whitebalance can be fixed with some postprocessing, but the exposure is an issue that would need to be fixed in the camera driver. But the nice thing is that the front camera can already get pictures of the full native resolution of the sensor (1600x1200)
Camera.py
I've updated camera.py to support these camera features in the same repository as the original script: https://git.sr.ht/~martijnbraam/python-pinecamera