Show rectangle in camera preview and crop image within it using android camera2 -




i have been trying achieve this using android camera2.

i want rectangle load on top of camera preview , once press button capture image image should cropped within rectangle preview. have tried numerous solutions find of them using deprecated android hardware.camera , not camera2. ones find camera2 , textureview not have code cropping. in above image, have put overlay on texture view using image made in photoshop. how should crop within rectangle bounds?

thanks.

to add rectangle can define image in xml layout file , position in centre of preview.

cropping uses scalar_crop_region:

rect croprect = new rect(0, 0, 1755, 3120); capturerequestbuilder.set(capturerequest.scaler_crop_region, croprect);





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

python - Minimize function with Scipy minimize -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -