Retrieve the focus regions configured on the camera.


#include <camera/camera_api.h>
camera_error_t camera_get_focus_regions(camera_handle_t handle, int numasked, int *numsupported, int *numreturned, camera_region_t *regions)



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


The requested number of regions to return in the regions array. You can specify a value of zero to determine the number of supported focus regions available on the camera.


The pointer to an integer that is populated with the number of focus regions supported by the camera.


The pointer to an integer that is populated with the number of focus regions returned in the regions array.


A pointer to a camera_region_t array. The array is updated with the focus regions configured on the camera. Ensure that you create an array with the same number of elements as the numasked argument.




This function allows you to retrieve the configured autofocus grid from the camera. See camera_set_focus_regions() for details on configuring this grid. When regions are defined, the autofocus algorithm will give priority to focusing on objects in the defined areas.

The maximum number of supported focus regions is determined by checking the numsupported argument when the function completes successfully.

When calling this function, ensure that the regions argument points to an array which has at least the number of elements allocated as specified in the numasked argument. To determine an appropriate size for this array, you can invoke this function in presizing-mode by setting the numasked argument to 0 or regions argument set to NULL. When the function is invoked in this presizing-mode, the maximum array size required is returned in numsupported argument. You can then allocate an array of the appropriate size and invoke the function again with numasked argument set to the value returned previously in the numsupported argument.


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