Jeeva
Jeeva

Reputation: 448

How can i get the image as in the preview size of TextureView in camera 2

I am learning camera 2 API using google sample code android-Camera2Basic in that i have changed the width and height of AutoFitTextureView to 200 dp and when i capture the picture then i seeing that picture has more focused area than the preview size.

So How can i get the image as in the preview?

Upvotes: 2

Views: 829

Answers (1)

Mick
Mick

Reputation: 25471

Assuming you want the image to be cropped the same way as your preview, which is what I think you are asking, you can use the the SCALER_CROP_REGION which is a field of the Camera2 API CaptureRequest class.

More information is available here: https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html#SCALER_CROP_REGION

Upvotes: 1

Related Questions