I'm trying to get digital zoomed frame on Android 5.0 with camera2 interface. Appropriate doc for that functionality is developer.android.com/camera2/captureRequest
Surface used in my application:
Camera's sensor size is 3280x2464 (4:3 aspect ratio)
Crop region which I want to get from sensor is:
Rect zoomCropPreview = new Rect(1094, 822, 2186, 1642); //(1092x820, 4:3 aspect ratio)
I set this Rect as parameter for preview request:
previewRequestBuilder.set(CaptureRequest.SCALER_CROP_REGION, zoomCropPreview);
captureSession.setRepeatingRequest(previewRequestBuilder.build(), null, null);
And to take still image:
stillRequestBuilder.set(CaptureRequest.SCALER_CROP_REGION, zoomCropPreview);
captureSession.capture(stillRequestBuilder.build(), new captureListener() , null);
Expected results:
Real result:
What am I doing wrong?
Fixed! General idea is to calculate crop region for preview and still images separately.
1) Calculate crop region for still image as in initial post (use 4:3 rectangle)
2) For preview take above crop region (4:3) and reduce vertical size to get 16:9 rectangle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With