diff options
author | Hyunwoo Kim <hw4444.kim@samsung.com> | 2012-08-27 15:17:26 +0900 |
---|---|---|
committer | Hyunwoo Kim <hw4444.kim@samsung.com> | 2012-08-27 15:17:26 +0900 |
commit | 1a0dbda71f40c1e2e3cf5e95462e7b02e341896b (patch) | |
tree | 069dc8ff38fa2dd65c520ec472f5eb5106711144 | |
parent | 45f262118125fbade14623e122c136f0ddf50727 (diff) | |
download | face-1a0dbda71f40c1e2e3cf5e95462e7b02e341896b.tar.gz face-1a0dbda71f40c1e2e3cf5e95462e7b02e341896b.tar.bz2 face-1a0dbda71f40c1e2e3cf5e95462e7b02e341896b.zip |
Add api for setting detection_mode
Change-Id: I726bd89a3cab5401ae854dc76240186af10153a8
-rwxr-xr-x | include/face.h | 36 | ||||
-rwxr-xr-x | packaging/capi-uix-face.spec | 2 | ||||
-rwxr-xr-x | src/face.c | 101 |
3 files changed, 137 insertions, 2 deletions
diff --git a/include/face.h b/include/face.h index 2ad6bdd..72295a1 100755 --- a/include/face.h +++ b/include/face.h @@ -102,6 +102,14 @@ typedef enum { FACE_IMAGE_TYPE_CONTINIOUS, /**< video frame */ } face_image_type_e; +/** + * @brief Enumerations for face detection option. + * @see face_attr_set_detect_mode(), face_attr_get_detect_mode() + */ +typedef enum { + FACE_DETECT_MODE_FAST, /**< Mode to detect faces as fast as possible even if the accuracy is low */ + FACE_DETECT_MODE_ROBUST, /**< Mode to detect faces as accurate as possible even if it takes more time */ +} face_detect_mode_e; /** * @brief Represents a rectangular region in a coordinate space @@ -375,6 +383,34 @@ int face_attr_get_detect_inteval(face_h face, int *detect_interval); /** + * @brief Sets detection mode for single image detection + * @details Sets detection mode for single image detection + * @remarks Interval has to positive number + * @param[in] face The facial engine handle + * @param[in] detect_mode Detection mode + * @return 0 on success, otherwise a negative error value. + * @retval #FACE_ERROR_NONE Successful + * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter + * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found + * @see face_attr_get_detect_mode() + */ +int face_attr_set_detect_mode(face_h face, face_detect_mode_e detect_mode); + +/** + * @brief Gets detection mode for single image detection + * @details Sets detection mode for single image detection + * @param[in] face The facial engine handle + * @param[out] detect_mode Detection mode + * @return 0 on success, otherwise a negative error value. + * @retval #FACE_ERROR_NONE Successful + * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter + * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found + * @see face_attr_set_detect_mode() + */ +int face_attr_get_detect_mode(face_h face, face_detect_mode_e *detect_mode); + + +/** * @brief Detects faces from the image data. * @param[in] face The facial engine handle * @param[in] image_type The type of the image diff --git a/packaging/capi-uix-face.spec b/packaging/capi-uix-face.spec index 211498c..d783f2a 100755 --- a/packaging/capi-uix-face.spec +++ b/packaging/capi-uix-face.spec @@ -1,6 +1,6 @@ Name: capi-uix-face Summary: Face detector & recognizer C-API v1.0 -Version: 0.1.30 +Version: 0.1.32 Release: 1 Group: misc License: Apache @@ -459,7 +459,9 @@ EXPORT_API int face_get_movement( __in face_h face, face_engine_error_e ferr; - ferr = face_engine_track_faces(face->fengine, &prev ,&cur); +// ferr = face_engine_track_faces(face->fengine, &prev ,&cur); + + ferr = face_engine_track_faces1(face->fengine, prev_image->pixel, cur_image->pixel, prev_image->width, prev_image->height, &prev ,&cur); if ( ferr != FACE_ENGINE_ERROR_NONE ) { @@ -1092,3 +1094,100 @@ EXPORT_API int face_attr_get_detect_inteval(face_h face, int *detect_interval) } + +EXPORT_API int face_attr_set_detect_mode(face_h face, face_detect_mode_e detect_mode) +{ + if ( _validate_face_h(face) == false ) + { + LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER)); + return FACE_ERROR_INVALID_PARAMTER; + } + +// Check range. + if ( detect_mode != FACE_DETECT_MODE_FAST && detect_mode != FACE_DETECT_MODE_ROBUST ) + { + LOG_ERROR("[%s] Invalid detect mode : %d", _face_convert_error(FACE_ERROR_INVALID_PARAMTER), detect_mode); + return FACE_ERROR_INVALID_PARAMTER; + } + + face_engine_error_e ferr; + face_engine_param_t param; + + ferr = face_engine_get_param(face->fengine, ¶m); + + if ( ferr != FACE_ENGINE_ERROR_NONE ) + { + LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr))); + return _convert_to_face_error_e(ferr); + } + + face_engine_detection_mode_e eMode; + + if (detect_mode == FACE_DETECT_MODE_ROBUST) + { + eMode = FACE_ENGINE_DETECTION_MODE_ROBUST; + } + else + { + eMode = FACE_ENGINE_DETECTION_MODE_FAST; + } + + if ( param.eMode != eMode) + { + param.eMode = eMode; + + ferr = face_engine_set_param(face->fengine, ¶m); + + if ( ferr != FACE_ENGINE_ERROR_NONE ) + { + LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr))); + return _convert_to_face_error_e(ferr); + } + } + + return FACE_ERROR_NONE; + +} + + +EXPORT_API int face_attr_get_detect_mode(face_h face, face_detect_mode_e *detect_mode) +{ + if ( _validate_face_h(face) == false ) + { + LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER)); + return FACE_ERROR_INVALID_PARAMTER; + } + + if ( detect_mode == NULL ) + { + LOG_ERROR("[%s] out detect_mode is null", _face_convert_error(FACE_ERROR_INVALID_PARAMTER)); + return FACE_ERROR_INVALID_PARAMTER; + } + + face_engine_error_e ferr; + face_engine_param_t param; + + ferr = face_engine_get_param(face->fengine, ¶m); + + if ( ferr != FACE_ENGINE_ERROR_NONE ) + { + LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr))); + return _convert_to_face_error_e(ferr); + } + + if ( param.eMode == FACE_ENGINE_DETECTION_MODE_ROBUST) + { + *detect_mode = FACE_DETECT_MODE_ROBUST; + } + else + { + *detect_mode = FACE_DETECT_MODE_FAST; + } + + return FACE_ERROR_NONE; + +} + + + + |