Access to ToF camera depth data while taking pictures (Note 10+, Camera2 API)

Hi, I’m working with Note 10+ to get depth(distance) data while taking pictures using Android Camera2 API.

At first, I read this topic, (actually, he tested ToF camera of Huawei P30 Pro)
Is CameraX supported Time Of Flight (TOF) camera?

and I created a project that can be tested on my device by referring to Google’s Camera2Raw sample and that post.

I succeeded in accessing and opening the ToF camera via property CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT, but failed to create a Capture Session with some errors.

  1. There’s no JPEG format in CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP of ToF camera.(only DEPTH16 format.)
  2. There’s no output size of SurfaceTexture in CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP of ToF camera.
  3. Finally failed to create capture session with this message

Stream configuration failed due to: createSurfaceFromGbp:1155: Camera 4: No supported stream configurations with format 0x22 defined, failed to create output stream

So, my questions are,

  1. Is it possible to get depth(distance) data of ToF Camera by camera2 API or cameraX extension?
  2. Is it possible to get that data while taking normal pictures?


1 Like

I got the answer that accessing depth data is currently only supported via camera2 API. Does anyone know more details about this?

I finally got ToF depth data by camera2 api through this blog and his github.
It also would be helpful if you understand the flow of the Google’s old Camera2Basic sample.