2

I'm trying to preview an external ZED stereo camera that's connected to an android phone using the Camera2 api.

https://www.stereolabs.com/zed/

This camera is UVC compliant and I have been able to preview it when I connected it to an android oreo 8.0 vm running on virtual box.

I'm using the code in google's sample project https://github.com/googlesamples/android-Camera2Basic. The CameraManager class provides a getCameraIdList() which is supposed to return the ids of all the cameras connected to the device, like the front facing, back facing or external facing (in this case it should have been my ZED cam or any other external webcam) camera.

When i run the sample on virtual box the external camera seems to be detected as a back facing camera.

CameraCharacteristics characteristics
                    = manager.getCameraCharacteristics(cameraId);

            Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING);
            String[] cameras = new String[] {"FRONT", "BACK", "EXTERNAL"};

            Log.v(TAG, "Camera faces " + cameras[facing]);

The external ZED cam always shows as a back facing camera. When i try to run the apk on an android phone with the ZED cam connected to the USB C interface, It simply does not detect the web cam at all.

In fact I ran the app USB Device Info on the phone when the cam was connected and it showed up as a video device

I then ran the app Camera2 Api Probe which probes for cameras and all their supported characteristics using the camera2 api on the phone and it only listed the front and back facing cams that are part of my phone. It didn't list the external camera.

I tried this with a Samsung A7 (2017), a One Plus and an Honor all running andoird Oreo 8.0. None of then could list the external facing camera but all of them showed the usb device as connected and a video device with the name ZED.

I have no idea why they don't show up. How do i get external cameras to list using the camera2 api?

I initially tried projects that use JNI bindings to native code that uses libuvc like this one . But the frame rates seem to be too slow. But right now I'm focused on getting the preview using the camera2 api.

FYI: I suspected that the camera might not be receiving enough power. So i connected the camera using a Trancend USB 3.0 hub with an external power supply that can power connected usb devices. The results were the same.

Just to be clear, when using the vbox emulator the external device is listed as a back facing camera. When using Genymotion I have to use it's camera widget to set the connected ZED cam to either the back or front facing camera and then it lists.

arun tom
  • 151
  • 1
  • 9

0 Answers0