2

I am using Android cameraX with ImageAnalysis for face detection using ML-kit, But now I want to use USB camera instead of a front or back camera but cameraX provides only 2 options.

CameraSelector.LENS_FACING_BACK
CameraSelector.LENS_FACING_FRONT
  • if you could see the external camera, you could use CameraSelector.Builder.addCameraFilter() to select the external camera. – Gerry Nov 19 '21 at 01:21
  • val cameraSelector = CameraSelector.Builder() .addCameraFilter { it.filter { camInfo -> Camera2CameraInfo.from(camInfo).getCameraCharacteristic(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL) == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL } }.build() – Gerry Nov 19 '21 at 01:27
  • @Gerry does it actually work? Afaik cameraX doesn't support usb cameras – Nodar Maruashvili May 02 '22 at 17:52
  • There are code in it, not tested though. I did not get it detected when I was trying it. – Gerry May 03 '22 at 18:57

0 Answers0