android / android/camera-samples
DEPTH 16 format produces 0 values
- Dominant language
- Kotlin
- Stars
- 5.5k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Is DEPTH16 in Camera2 API ready to use? or we are supposed to use ARCore for depth detection? My use case is not to render depth data/image continuously on screen, but to capture a JPEG image and it's depth when user tap on capture button in a shot.
I created a capture request of TEMPLATE_PREVIEW / TEMPLATE_STILL_PICTURES for target image reader of Image Format DEPTH16 as following.
```
imageReader = ImageReader.newInstance(
240, 180, ImageFormat.DEPTH16, IMAGE_BUFFER_SIZE)
```
```
val captureRequest = camera.createCaptureRequest(
CameraDevice.TEMPLATE_PREVIEW).apply {
addTarget(depthImageReader.surface)
}
```
captureRequest.set(CaptureRequest.JPEG_ORIENTATION, 0)
val fpsRange: Range = Range(15, 30)
captureRequest.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, fpsRange)
session.capture(captureRequest.build(), null, null)
```
imageReader.setOnImageAvailableListener({ reader ->
val image = reader.acquireNextImage()
```
on this image , with session.capture, the depth samples are all 0. if I replace it with session.setRepeatingRequest(captureRequest.build(), null, null), the first frames are still all 0 values, after some movement, the later frames has a a lot of 0, 8192, and very large values such as 17524 (17m which is not correct?), along with some random range.
I've tested https://medium.com/swlh/working-with-the-3d-camera-on-the-samsung-s10-5g-4782336783c , however the first frames are 0 as well
Contributor guide
Research direction
Start by reviewing the Camera2 API documentation for ImageFormat.DEPTH16, ImageReader, and capture requests. Reproduce the issue using the shown 240×180 DEPTH16 setup with both session.capture and setRepeatingRequest, then determine whether the zero and out-of-range samples indicate unsupported device behavior or an application error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100