Capture Image of Specific area android CameraX

587 Views Asked by At

Is it possible to show a rectangle in the camera that captures the image only the rectangular part of the camera and skips all other parts?

enter image description here

I don't want to use any third-party library. I want to use simple CameraX.

1

There are 1 best solutions below

2
Xi 张熹 On

You can take a picture of the whole FOV then crop it.

The challenge is that the Preview and ImageCapture usually have different resolution, rotation and mirroring. To do that, you will need to transform your Preview crop rect into ImageCapture coordinate system.

You can take a look at the CoordinateTransform API provided by CameraX.