2 Copyright (c) 2000-2012 Samsung Electronics Co., Ltd All Rights Reserved
4 This file is part of face-engine
5 Written by Hyunwoo Kim <hw4444.kim@samsung.com>
7 PROPRIETARY/CONFIDENTIAL
9 This software is the confidential and proprietary information of
10 SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
11 disclose such Confidential Information and shall use it only in
12 accordance with the terms of the license agreement you entered
13 into with SAMSUNG ELECTRONICS.
14 SAMSUNG make no representations or warranties about the suitability
15 of the software, either express or implied, including but not limited
16 to the implied warranties of merchantability, fitness for a particular
17 purpose, or non-infringement. SAMSUNG shall not be liable for any
18 damages suffered by licensee as a result of using, modifying or
19 distributing this software or its derivatives.
23 #ifndef __FACE_ENGINE_H__
24 #define __FACE_ENGINE_H__
29 * @brief Facial engine handle type.
31 typedef void* face_engine_h;
34 * @brief Enumerations of error codes for the FacialEngine API.
37 FACE_ENGINE_ERROR_NONE = 0, /**< Successful */
38 FACE_ENGINE_ERROR_INVALID_PARAMTER = -1, /**< A specified input parameter is invalid. */
39 FACE_ENGINE_ERROR_OUT_OF_MEMORY = -2, /**< The memory is insufficient. */
40 FACE_ENGINE_ERROR_OPERATION_FAILED = -3, /**< Does not support this property. À߸øµÈ state */
41 FACE_ENGINE_ERROR_FAILURE = -4, /**< A system error has occurred. ³»ºÎ error */
42 FACE_ENGINE_ERROR_ENGINE_NOT_FOUND = -5,
43 } face_engine_error_e;
46 * @brief Enumerations of input image format for the FacialEngine API.
49 FACE_ENGINE_IMAGE_FORMAT_Y, /**< luminance only image*/
50 } face_engine_image_colorspace_e;
53 * @brief Enumerations of facial expression that recognized for the FacialEngine API.
56 FACE_ENGINE_EXPRESSION_UNKNOWN,
57 FACE_ENGINE_EXPRESSION_NUETRAL, /**< Normal expression */
58 FACE_ENGINE_EXPRESSION_ANGRY, /**< Angry expression */
59 FACE_ENGINE_EXPRESSION_SMILE, /**< Cheerful expression */
60 FACE_ENGINE_EXPRESSION_SURPRISE, /**< Suprised expression */
61 } face_engine_expression_e;
64 * @brief Enumerations of the eye state for the FacialEngine API.
67 FACE_ENGINE_EYE_UNKNOWN, /**< The no eye state, when the eye detect fails */
68 FACE_ENGINE_EYE_OPENED, /**< The state when eye is opened */
69 FACE_ENGINE_EYE_CLOSED, /**< The state when eye is closed */
73 FACE_ENGINE_IMAGE_TYPE_SINGLE, /**< */
74 FACE_ENGINE_IMAGE_TYPE_CONTINIOUS,
75 } face_engine_image_type_e;
78 int x; /**< x-coordinate */
79 int y; /**< y-coordinate */
80 } face_engine_point_t;
83 int x; /**< most left coordinate of detected face region */
84 int y; /**< most top coordinate of detected face region */
85 int w; /**< width of detected face region */
86 int h; /**< height of detected face region */
90 unsigned char *pixel; /**< pixel data */
92 int width; /**< image data's width */
93 int height; /**< image data's height */
95 face_engine_image_colorspace_e colorspace; /**< color space */
96 } face_engine_image_t;
100 face_engine_rect_t face; // 16
102 face_engine_point_t lefteye; // 8
103 face_engine_point_t righteye; // 8
105 face_engine_rect_t mouse; // 16
109 } face_engine_component_t;
112 FACE_ENGINE_DETECTION_MODE_FAST,
113 FACE_ENGINE_DETECTION_MODE_ROBUST,
114 } face_engine_detection_mode_e;
119 int nMaxFaceNum; /**< */
121 int nInterval; /**< */
123 face_engine_detection_mode_e eMode; /**< Default is fast*/
127 } face_engine_param_t;
130 unsigned char *data; /**< result data of face information */
131 unsigned int len; /**< size of result data */// in byte unit
132 } face_engine_feature_t;
139 face_engine_error_e face_engine_create(face_engine_h *handle);
140 face_engine_error_e face_engine_destroy(face_engine_h handle);
142 face_engine_error_e face_engine_get_param(face_engine_h handle, face_engine_param_t *param);
143 face_engine_error_e face_engine_set_param(face_engine_h handle, const face_engine_param_t *param);
146 face & orientation should be freed using free() by user.
148 orientation indicates degree and it's range is 0~359.
150 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);
152 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);
154 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);
156 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);
157 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);
159 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);
161 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);
163 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);
171 #endif // __TIZEN_UIX_FACE_ENGINE_H__