camera-samples icon indicating copy to clipboard operation
camera-samples copied to clipboard

DEPTH 16 format produces 0 values

Open kaj777 opened this issue 4 years ago • 2 comments

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<Int> = Range<Int>(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

kaj777 avatar Oct 28 '21 13:10 kaj777

@ggfan could you advice please? appreciate it.

kaj777 avatar Oct 28 '21 13:10 kaj777

Did you get anyway with your research, @kaj777 ??

etozzato avatar Oct 06 '22 18:10 etozzato