How to use the widest angle lense with Camera2/CameraX API

1.1k views Asked by At

I am trying to get the cameraId of the widest lense available on the rear side of the device. I am getting the "logical" rear camera just fine, as documented here. But it defaults to a random rear physical camera that is not the widest camera. I tried to follow the Multi-camera API documentation but for any device I ask if any of the cameras has CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA, it always returns false.

  • For cameraManager.cameraIdList, I seem to always just get one front and rear camera.
  • cameraManager.getCameraCharacteristics(cameraId).physicalCameraIds also always returns empty.
  • cameraManager.getCameraCharacteristics(cameraId).availablePhysicalCameraRequestKeys also always returns empty.

What could I be doing wrong? I am targeting API 29 and running on API 30 devices. Don't want to use deprecated camera API, but it seems like this used to be doable in that API. What other info would you all need?

1

There are 1 answers

0
Wasim Ansari On

You can calculate which camera has biggest FOV based on sensor size and focal length.

Fov Angle = 2*atan(l/2d), where l is sensor size and d is focal length.

You can find the math behind this formula here. https://stackoverflow.com/a/3261794/11861734