I am trying to get a digital zoom frame on Android 5.0 using camera2 interface. Related document for this developer.android.com/camera2/captureRequest feature
Surface used in my application:
- SurafaceView (aspect ratio 1920x1080, 16: 9).
- ImageReader (3264x2448, 4: 3 format)
The size of the camera sensor is 3280x2464 (4: 3 aspect ratio)
The cropping area that I want to get from the sensor:
Rect zoomCropPreview = new Rect(1094, 822, 2186, 1642);
I set this Rect as a parameter for the preview request:
previewRequestBuilder.set(CaptureRequest.SCALER_CROP_REGION, zoomCropPreview); captureSession.setRepeatingRequest(previewRequestBuilder.build(), null, null);
And take a still image:
stillRequestBuilder.set(CaptureRequest.SCALER_CROP_REGION, zoomCropPreview); captureSession.capture(stillRequestBuilder.build(), new captureListener() , null);
Expected results:
- Coz's straight rectangle is 4: 3, then the preview should be cropped vertically (mailbox)
- The image must be accurate.
- Both the preview and the still image should be focused on the same point in the scene and should differ only in vertical edges.
The real result:
- Preview and still image on another scene, which seems to be moving vertically. Look at the attached images.


What am I doing wrong?
source share