Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use rear facing dual camera in Android

I'm trying to capture using both of the rear facing cameras on my xiaomi mi 5s plus. When I'm trying to iterate through the id's of the cameras using camera2 api, I only get 2 id's, one for the front facing camera and one for the rear one. I've looked in the lg development examples (http://mobile.developer.lge.com/develop/sdks/lg-dual-camera/) and they are using 3 ids. When running their example, the app crashes.

The code used for getting the ids is:

CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
for(String id: manager.getCameraIdList())
    Log.e("test", id);
like image 362
Petru Avatar asked Mar 21 '17 15:03

Petru


1 Answers

Capturing images from a dual camera is not natively supported before Android P. Android P now supports multi camera capture -> https://developer.android.com/preview/features#camera

Different vendors provide dual cameras for their Android devices in hope to improve the photo quality for average user, more often than not, specifically tuned for special conditions like challenging illumination or distortions of selfie mode. Each vendor uses proprietary technologies to handle dual cameras, and they are not interested to disclose the implementation details. The only public interface they support is a virtual single camera which is more or less compliant with Google specs.

Courtesy of this Stack Overflow answer

like image 150
BennyHawk Avatar answered Sep 26 '22 02:09

BennyHawk