Skip to content Skip to sidebar Skip to footer

How To Get The Distance From An Object To Android Device Using Camera2 Api

I want to get the distance from an object to android device using android camera2 API. In CaptureCallback, I get the value by result.get(CaptureResult.LENS_FOCUS_DISTANCE) and chec

Solution 1:

Please check the value of CameraCharacteristics.LENS_INFO_FOCUS_DISTANCE_CALIBRATION. If it's UNCALIBRATED or APPROXIMATE, then the value of LENS_FOCUS_DISTANCE will likely not be close to reality.

And even with CALIBRATED, the farther objects are, the more error there will be - to the camera, everything past the hyperfocal distance (a few meters at best) starts being impossible to accurately measure distance to.

Post a Comment for "How To Get The Distance From An Object To Android Device Using Camera2 Api"