Instruct the camera of the current device orientation.


#include <camera/camera_api.h>
camera_error_t camera_set_device_orientation(camera_handle_t handle, uint32_t val)



The handle returned by a call to the camera_open() function.


The orientation value, such as 0, 90, 180, or 270. Zero represents the default orientation (landscape or portrait), 90 represents rotated to the right, and 180 degrees represents upside down based on the marking on the device.




You can specify values such as 0, 90, 180 or 270 degrees, where 0 degrees is the default orientation of the device. It is the responsibility of an application to update the camera when the device orientation changes.

Use this function to let the camera on the system know how the user is holding the device. This allows the camera to adjust internal parameters, such as exposure weighting, face detection, or other orientation-dependent features to match the orientation of the device.

This function has no effect on the output image rotations. It is simply used to inform the camera hardware that the orientation of the scene has changed in order to optimize internal algorithms, such as metering and face detection.


CAMERA_OK when the function successfully completes, otherwise another camera_error_t value that provides the reason that the call failed.