How can i set rotation of camera capture request?

307 Views Asked by At

I'm using ndk to create application that captures through camera and displays the images. I succeed to capture and display images but the rotation of images is not normal. So, i tried to change the rotation of images by using ACaptureRequest_setEntry_u8 function. But it returns this error message in logcat(E/ACameraMetadata: Error: tag 917518 is not writable!). I tried to check whether ACAMERA_SENSOR_ORIENTATION is included in ACameraMetadata and it is. Below is the code. I used two days to correct this problem. Please help me.

ACameraDevice_createCaptureRequest(mainCameraDevice, TEMPLATE_STILL_CAPTURE,
                                   &mainCaptureRequest);
uint8_t degree = 90;
ACaptureRequest_setEntry_u8(mainCaptureRequest, ACAMERA_SENSOR_ORIENTATION, 1, &degree);

And i'm using ACameraCaptureSession_setRepeatingRequest to capture sequentially.

1

There are 1 best solutions below

1
On

I'm not using NDK to take a picture but I've done the following to correctly rotate the output image: https://stackoverflow.com/a/51892093/10159898

Given code are both in Kotlin and Java.

Hope It can help you