How reliable is the camera for the Android2 CameraCharacteristics API for sensor size?

I am trying to get / compute FOV for device cameras using the camera2API my code below).

During my attempt on galaxy S7:

  • this sensor size is 3.2 mm x 2.4 mm (using SENSOR_INFO_PHYSICAL_SIZE).
  • In this case, my calculated HFOV is 41.7 Β° (the given focal length is 4.2 mm), which I proved wrong by experimenting.
  • Different specifications indicate the size of the sensor 1 / 2.5 "(5.76 mm x 4.29 mm according to wikipedia ) - which would give me an HFOV of 68.9 Β°, closer to my experiments.
  • the values ​​in CameraCharacteristicsseem wrong.

The same queries and experiments on the Samsung Galaxy A3-2016 are more convincing, the calculated HFOV seems to correspond to the experimental one.

Does anyone have experience or data to exchange information about the reliability of the testimony CameraCharacteristics?


The code I used to query CameraCharacteristics::

CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraID);
if (characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT)
    continue;

int support = characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
if( support == CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY )
    Log.d("mr", "Camera " + cameraID + " has LEGACY Camera2 support");
else if( support == CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED )
    Log.d("mr", "Camera " + cameraID + " has LIMITED Camera2 support");
else if( support == CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_FULL )
    Log.d("mr", "Camera " + cameraID + " has FULL Camera2 support");
else
    Log.d("mr", "Camera " + cameraID + " has unknown Camera2 support?!");

// voir http://myandroidarchive.tistory.com/5 pour le query android
// voir http://paulbourke.net/miscellaneous/lens/ pour les maths
// include every focal length supported by the camera device, in ascending order.
float[] focalLengths = characteristics.get(CameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS);
SizeF sensorSize = characteristics.get(CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE);

float w = 0.5f * sensorSize.getWidth();
float h = 0.5f * sensorSize.getHeight();
Log.d("mr", "Camera " + cameraID + " has sensorSize == " + Float.toString(2.0f*w) + ", " + Float.toString(2.0f*h));
for (int focusId=0; focusId<focalLengths.length; focusId++) {
    float focalLength = focalLengths[focusId];
    float horizonalAngle = (float) Math.toDegrees(2 * Math.atan(w / focalLength));
    float verticalAngle = (float) Math.toDegrees(2 * Math.atan(h / focalLength));
    Log.d("mr", "Camera " + cameraID + "/f" + focusId + " has focalLength == " + Float.toString(focalLength));
    Log.d("mr", "  * horizonalAngle == " + Float.toString(horizonalAngle));
    Log.d("mr", "  * verticalAngle == " + Float.toString(verticalAngle));
}
+4
source share
1 answer

Scanbot developer is here (otherwise I worked with the camera enough).

Camera API , API . , API , ( Android SDK), Google.

+2

Source: https://habr.com/ru/post/1660317/


All Articles