Search code examples
arcoreandroid-camerax

Is it possible to use ARCore with CameraX?


I am trying to use ARCore to return a depth image and also use the CameraX to return an RGB image. I can do both individually but when I combine both together the cameraX doesn't work.

I see that I must allow the shared camera but as far I searched, it can only be possible using the Camera2 API.

Does anyone know any way of using the CameraX instead?


Solution

  • Unfortunately, only one client can use a camera at a time, and both ARCore and CameraX assume they're the only user.

    This would require explicit sharing a camera instance between the two, and while I believe ARCore has some provisions for this, I don't believe CameraX is able to use ARCore's interfaces.

    So if you need the RGB image, you probably need to figure out how to ask ARCore for it, and not use CameraX at all.