I'm using an OV5640 camera (MIPI-CSI) with an i.MX8MP running Android 11 (android-11.0.0_2.6.0). The camera works fine, except the preview in the camera application is stretched. The pictures captured with the camera have the correct aspect ratio; only the preview is stretched. I'm using a 1280x720 display.
Any ideas what the problem could be? Kernel driver? Libcamera?
Hello,
This is a aspect‑ratio mismatch between the preview, I suggest you change the camera parameters in Android camera source code. You can take a look about this in section 8.1 Camera configuration of document "Android User's Guide".
Best regards.
Which camera parameters should I change? Section 8.1 of the Android User's Guide describes the camera setup, but I'm encountering a preview issue. Captured images have the correct aspect ratio, which suggests the camera settings are accurate. The problem is limited to the camera preview in the application, indicating it may be related to the display size or scaling rather than the camera itself. Do you have any suggestions?
The issue is likely an aspect ratio mismatch in the HAL (Hardware Abstraction Layer) or camera_config.xml, where the preview resolution being requested doesn't match the display's 16:9 ratio. Check your Camera HIDL implementation to ensure the StreamConfigurationMap provides a preview size that matches the sensor's output without cropping or stretching.
I’ve reviewed the camera settings and everything looks correct. One observation: the camera preview only stretches when the camera orientation differs from the display orientation. If I set the orientation to 0, the preview is fine. However, our design requires the camera to be rotated, so I have it set to 90.
It seems like an issue within the Camera2 app - any ideas on what might be causing this?