Tizen Native API
7.0
|
The Face Detection API provides functions to detect face information about stored image files.
Required Header
#include <media_content.h>
Related Features
This API is related with the following feature:
- http://tizen.org/feature/vision.face_recognition It is recommended to create applications with regard to features, to increase reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on a device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Overview
The Face Detection API provides functions to detect face information associated with image files.
Face information detected by mediavision API. To detect faces, you should use media_info_start_face_detection() API.
API allows to:
- start and cancel face detection with image files
To start face detection, call the media_info_start_face_detection() function.
To cancel face detection after it's been started, call the media_info_cancel_face_detection() function.
Functions | |
int | media_info_start_face_detection (media_info_h media, media_face_detection_completed_cb callback, void *user_data) |
Starts face detection for the given image, asynchronously. | |
int | media_info_cancel_face_detection (media_info_h media) |
Cancels face detection of image for the given media. | |
Typedefs | |
typedef void(* | media_face_detection_completed_cb )(media_content_error_e error, const int face_count, void *user_data) |
Called when face detection on the image is completed. |
Typedef Documentation
typedef void(* media_face_detection_completed_cb)(media_content_error_e error, const int face_count, void *user_data) |
Called when face detection on the image is completed.
The following error codes can be delivered.
MEDIA_CONTENT_ERROR_NONE,
MEDIA_CONTENT_ERROR_OUT_OF_MEMORY,
MEDIA_CONTENT_ERROR_INVALID_OPERATION,
MEDIA_CONTENT_ERROR_DB_FAILED,
MEDIA_CONTENT_ERROR_DB_BUSY,
MEDIA_CONTENT_ERROR_UNSUPPORTED_CONTENT
- Since :
- 3.0
- Remarks:
- The callback is called in a separate thread(not in the main loop).
- Parameters:
-
[in] error The error code [in] face_count The number of all detected faces [in] user_data The user data passed from the foreach function
- Precondition:
- media_info_start_face_detection()
- See also:
- media_info_start_face_detection()
Function Documentation
int media_info_cancel_face_detection | ( | media_info_h | media | ) |
Cancels face detection of image for the given media.
This function cancels face detection for given media item.
If you cancel face detection request before callback is invoked, the callback registered by media_info_start_face_detection() function will not be invoked.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/content.write
- Remarks:
- If face detection is already done when you request the cancellation, this function returns MEDIA_CONTENT_ERROR_INVALID_OPERATION
- Parameters:
-
[in] media The handle to the media info
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
- Precondition:
- This function requires opened connection to content service by media_content_connect().
int media_info_start_face_detection | ( | media_info_h | media, |
media_face_detection_completed_cb | callback, | ||
void * | user_data | ||
) |
Starts face detection for the given image, asynchronously.
This function detects faces for given image item and calls the given callback function when the detection is completed.
The given callback function is called when the detection is completed.
To obtain the detected faces, call the media_info_foreach_face_from_db() function.
Supported image formats are jpg, png, and bmp.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/content.write
http://tizen.org/privilege/mediastorage
http://tizen.org/privilege/externalstorage
- Remarks:
- If you want to destroy the media handle before the callback invoked, you must cancel the face detection request using media_info_cancel_face_detection().
If the face detection fails, the face_count argument in media_face_detection_completed_cb() will be set to 0.
The face detection of media items in external storage except MMC is not supported.
Since 5.5, if the format of media data is unsupported, this function returns an error and the callback will not be invoked.
- Parameters:
-
[in] media The handle to the media info [in] callback The callback function to be invoked when detection is completed [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_CONTENT_ERROR_NONE Successful MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy MEDIA_CONTENT_ERROR_NETWORK Network fail MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied MEDIA_CONTENT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- This function requires opened connection to content service by media_content_connect().