1

So this is something that's been blocking us for a while now.
For context, we're trying to use Google's MediaPipe library on an Android tablet.

However, it crashes complaining about a Null array

    Process: com.example.jarvis, PID: 9853
    java.lang.NullPointerException: Attempt to read from null array
        at com.google.mediapipe.components.CameraXPreviewHelper.calculateFocalLengthInPixels(CameraXPreviewHelper.java:485)
        at com.google.mediapipe.components.CameraXPreviewHelper.updateCameraCharacteristics(CameraXPreviewHelper.java:472)
        at 

To investigate this further, we started looking into the Camera Characteristics returned, including making a separate APK just to see what's going on. Relevant part is here https://github.com/onthecrow/know-your-camera/blob/main/app/src/main/java/com/onthecrow/knowyourcamera/MainActivity.kt#L86

                if (!characteristicsStateValue.characteristicsExists) {
                    Text(text = "Can't obtain the camera characteristics!")
                }
                if (!characteristicsStateValue.focalLengthCharacteristicsExists) {
                    Text(text = "Obtained characteristics doesn't contain the focal length")
                }
                if (!characteristicsStateValue.sensorWidthCharacteristicsExists) {
                    Text(text = "Obtained characteristics doesn't contain the sensor width")
                }

It seems like LENS_INFO_AVAILABLE_FOCAL_LENGTHS and SENSOR_INFO_PHYSICAL_SIZE are null when they shouldn't be. We're running Android 11, and these seem like they're supposed to always be present https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#LENS_INFO_AVAILABLE_FOCAL_LENGTHS

Any ideas what's going on? We have also considered trying to find the right Camera Characteristics some other way and then hard coding them into the Dict before they're read - not ideal but possible if we could figure it out.

0 Answers0