2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __FACE_ENGINE_H__
18 #define __FACE_ENGINE_H__
23 * @brief Facial engine handle type.
25 typedef void* face_engine_h;
28 * @brief Enumerations of error codes for the FacialEngine API.
31 FACE_ENGINE_ERROR_NONE = 0, /**< Successful */
32 FACE_ENGINE_ERROR_INVALID_PARAMTER = -1, /**< A specified input parameter is invalid. */
33 FACE_ENGINE_ERROR_OUT_OF_MEMORY = -2, /**< The memory is insufficient. */
34 FACE_ENGINE_ERROR_OPERATION_FAILED = -3, /**< Does not support this property. À߸øµÈ state */
35 FACE_ENGINE_ERROR_FAILURE = -4, /**< A system error has occurred. ³»ºÎ error */
36 FACE_ENGINE_ERROR_ENGINE_NOT_FOUND = -5,
37 } face_engine_error_e;
40 * @brief Enumerations of input image format for the FacialEngine API.
43 FACE_ENGINE_IMAGE_FORMAT_Y, /**< luminance only image*/
44 } face_engine_image_colorspace_e;
47 * @brief Enumerations of facial expression that recognized for the FacialEngine API.
50 FACE_ENGINE_EXPRESSION_UNKNOWN,
51 FACE_ENGINE_EXPRESSION_NUETRAL, /**< Normal expression */
52 FACE_ENGINE_EXPRESSION_ANGRY, /**< Angry expression */
53 FACE_ENGINE_EXPRESSION_SMILE, /**< Cheerful expression */
54 FACE_ENGINE_EXPRESSION_SURPRISE, /**< Suprised expression */
55 } face_engine_expression_e;
58 * @brief Enumerations of the eye state for the FacialEngine API.
61 FACE_ENGINE_EYE_UNKNOWN, /**< The no eye state, when the eye detect fails */
62 FACE_ENGINE_EYE_OPENED, /**< The state when eye is opened */
63 FACE_ENGINE_EYE_CLOSED, /**< The state when eye is closed */
67 FACE_ENGINE_IMAGE_TYPE_SINGLE, /**< */
68 FACE_ENGINE_IMAGE_TYPE_CONTINUOUS,
69 } face_engine_image_type_e;
72 int x; /**< x-coordinate */
73 int y; /**< y-coordinate */
74 } face_engine_point_t;
77 int x; /**< most left coordinate of detected face region */
78 int y; /**< most top coordinate of detected face region */
79 int w; /**< width of detected face region */
80 int h; /**< height of detected face region */
84 unsigned char *pixel; /**< pixel data */
86 int width; /**< image data's width */
87 int height; /**< image data's height */
89 face_engine_image_colorspace_e colorspace; /**< color space */
90 } face_engine_image_t;
94 face_engine_rect_t face; // 16
96 face_engine_point_t lefteye; // 8
97 face_engine_point_t righteye; // 8
99 face_engine_rect_t mouth; // 16
103 } face_engine_component_t;
106 FACE_ENGINE_DETECTION_MODE_FAST,
107 FACE_ENGINE_DETECTION_MODE_ROBUST,
108 } face_engine_detection_mode_e;
113 int nMaxFaceNum; /**< */
115 int nInterval; /**< */
117 face_engine_detection_mode_e eMode; /**< Default is fast*/
121 } face_engine_param_t;
124 unsigned char *data; /**< result data of face information */
125 unsigned int len; /**< size of result data */// in byte unit
126 } face_engine_feature_t;
133 face_engine_error_e face_engine_create(face_engine_h *handle);
134 face_engine_error_e face_engine_destroy(face_engine_h handle);
136 face_engine_error_e face_engine_get_param(face_engine_h handle, face_engine_param_t *param);
137 face_engine_error_e face_engine_set_param(face_engine_h handle, const face_engine_param_t *param);
140 face & orientation should be freed using free() by user.
142 orientation indicates degree and it's range is 0~359.
144 face_engine_error_e face_engine_detect_faces(face_engine_h handle, face_engine_image_type_e image_type, const face_engine_image_t *image, face_engine_rect_t *face[], int *orientation[], int *count);
146 face_engine_error_e face_engine_track_faces(face_engine_h handle, const face_engine_rect_t *prev_rect, face_engine_rect_t *cur_rect);
148 face_engine_error_e face_engine_track_faces1(face_engine_h handle, const unsigned char *prev_image, const unsigned char *cur_image, int width, int height, face_engine_rect_t *prev_rect, face_engine_rect_t *cur_rect);
150 face_engine_error_e face_engine_extract_face_component(face_engine_h handle, const face_engine_image_t *image, const face_engine_rect_t *rect, face_engine_component_t *component);
151 face_engine_error_e face_engine_extract_face_feature(face_engine_h handle, const face_engine_image_t *image, const face_engine_component_t *component, face_engine_feature_t *feature);
153 face_engine_error_e face_engine_compare_face_feature( face_engine_h handle, const face_engine_feature_t *A, const face_engine_feature_t *B, int *similarity);
155 face_engine_error_e face_engine_recognize_face_expression(face_engine_h handle, const face_engine_image_t *image , const face_engine_component_t *component, face_engine_expression_e *expression);
157 face_engine_error_e face_engine_recognize_blink(face_engine_h handle, const face_engine_image_t *image, const face_engine_component_t *component, face_engine_eye_e *lefteye, face_engine_eye_e *righteye);
165 #endif // __TIZEN_UIX_FACE_ENGINE_H__