From: howon kim Date: Mon, 9 Dec 2013 09:30:10 +0000 (+0900) Subject: Merge commits Tizen 2.2 to Tizen 2.2.1 X-Git-Tag: accepted/tizen/mobile/20131216.220436^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fframework%2Fnative%2Fface.git;a=commitdiff_plain Merge commits Tizen 2.2 to Tizen 2.2.1 Change-Id: Ic0b50d3cf05f5ed84b88f7e346105b3978b3c16d Signed-off-by: howon kim --- diff --git a/inc/FUixVision.h b/inc/FUixVision.h index 4f6ecff..8845030 100644 --- a/inc/FUixVision.h +++ b/inc/FUixVision.h @@ -19,7 +19,7 @@ * @file FUixVision.h * @brief This is the header file for the %Vision namespace. * - * This header file contains the declarations and descriptions of the %Vision namespace. + * This header file contains the declarations and descriptions of the %Tizen::Uix::Vision namespace. */ #ifndef _FUIX_VISION_H_ @@ -30,26 +30,18 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include /** * @namespace Tizen::Uix::Vision - * @brief This namespace contains the classes for the vision and its related functions. + * @brief This namespace contains the classes for the face and its related functions. * @since 2.0 * * @remarks @b Header @b %file: @b \#include @b @n - * @b Library : @b osp-face @b osp-vision + * @b Library : @b osp-face * - * The %Vision namespace provides the ability to automatically detect and trace natural objects including faces, image and QR Code in a still image or a video stream. + * The %Vision namespace provides the ability to automatically detect and trace faces in a still image or a video stream. * @n - * For more information on the class features, see Face Detector and Recognizer, Image recognizer and feature manager and QR code recognizer and generator + * For more information on the class features, see Face Detector and Recognizer. * * The following diagram illustrates the relationships between the classes belonging to the %Vision namespace. * @image html uix_vision_namespace_classdiagram.png diff --git a/inc/FUixVisionFaceComponentsPosition.h b/inc/FUixVisionFaceComponentsPosition.h index 9f19084..d2cbaa7 100644 --- a/inc/FUixVisionFaceComponentsPosition.h +++ b/inc/FUixVisionFaceComponentsPosition.h @@ -45,12 +45,11 @@ namespace Tizen { namespace Uix { namespace Vision * * The %FaceComponentsPosition class encapsulates the extracted face component's information that is processed by the FaceDetector class. * - * This class provides the following functionalities: + * This class provides the following functionalities: @n * - Getting/Setting the position of a face. * - Getting/Setting the position of the eyes. * - Getting/Setting the position of the mouth. - * - * For more information on the class features, see Face Detector and Recognizer. + *

For more information on the class features, see Face Detector and Recognizer.

*/ class _OSP_EXPORT_ FaceComponentsPosition @@ -59,7 +58,7 @@ class _OSP_EXPORT_ FaceComponentsPosition public: /** * This is the default constructor for this class. @n - * All values of the attributes are set to @c -1 when this instance is initialized. + * Initializes this instance of %FaceComponentsPosition with all its attributes set to @c -1. * * @since 2.0 */ @@ -151,7 +150,8 @@ public: * This position can be obtained using the FaceDetector::ExtractFaceComponentsN() method. * @param[in] rightEyePos The eye position on the right @n * This position can be obtained using the FaceDetector::ExtractFaceComponentsN() method. @n - * The position of the right eye must be greater than or equal to @c 0, and must be greater than the position of @c leftEyePos. + * The position of the eyes must be greater than or equal to @c 0. @n + * The position of @c rightEyePos must be greater than the position of @c leftEyePos. * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. */ @@ -174,7 +174,7 @@ public: /** * This is the copy constructor for the %FaceComponentsPosition class. @n - * Initializes this instance of %FaceComponentsPosition with the specified parameter. @n + * Initializes this instance of %FaceComponentsPosition with the specified parameter. * Copying of objects using this copy constructor is allowed. * * @since 2.0 diff --git a/inc/FUixVisionFaceDetector.h b/inc/FUixVisionFaceDetector.h index 2dbc808..7d5e377 100644 --- a/inc/FUixVisionFaceDetector.h +++ b/inc/FUixVisionFaceDetector.h @@ -133,7 +133,7 @@ class _OSP_EXPORT_ FaceDetector // Lifecycle public: /** - * This is the default constructor for this class. @n + * This is the default constructor for this class. * The object is not fully constructed after this constructor is called. * For full construction, the Construct() method must be called right after calling this constructor. * @@ -158,13 +158,9 @@ public: * * @since 2.0 * - * @feature %http://tizen.org/feature/vision.face_recognition * @return An error code * @exception E_SUCCESS The method is successful. - * @exception E_UNSUPPORTED_OPERATION The target device does not support the face detection feature. @b Since: @b 2.1 - * For more information, see Application Filtering. - * @remarks Before calling this method, check whether the feature is supported by - * Tizen::System::SystemInfo::GetValue(const Tizen::Base::String&, bool&). + * @exception E_OUT_OF_MEMORY The memory is insufficient. */ result Construct(void); @@ -272,9 +268,9 @@ public: * @exception E_SUCCESS The method is successful. * @exception E_OUT_OF_MEMORY The memory is insufficient. * @exception E_FAILURE A system error has occurred. - * @remarks - * - The specific error code can be accessed using the GetLastResult() method. - * - BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. + * @remarks + * - The specific error code can be accessed using the GetLastResult() method. + * - BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. * @endif */ Tizen::Base::Collection::IList* DetectFacesFromStillImageN(const Tizen::Graphics::Bitmap& bitmap); @@ -293,13 +289,14 @@ public: * @param[in] byteBuffer The buffer containing the input image data * @param[in] dim The width and height of the input image @n * Both the width and height must be greater than @c 0. - * @param[in] format The color format @n - * @c BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. + * @param[in] format The color format defined by Tizen::Graphics::BitmapPixelFormat * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. * @exception E_OUT_OF_MEMORY The memory is insufficient. * @exception E_FAILURE A system error has occurred. - * @remarks The specific error code can be accessed using the GetLastResult() method. + * @remarks + * - The specific error code can be accessed using the GetLastResult() method. + * - BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. */ Tizen::Base::Collection::IList* DetectFacesFromStillImageN(const Tizen::Base::ByteBuffer& byteBuffer, const Tizen::Graphics::Dimension& dim, Tizen::Graphics::BitmapPixelFormat format); @@ -372,7 +369,7 @@ public: /** * Gets the position difference of the face. @n - * The %GetFaceMovement() method can be used for tracking the face from a sequential video data. + * This can be used for tracking the face from a sequential video data. * * @since 2.0 * @@ -390,7 +387,7 @@ public: * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. * @exception E_OPERATION_FAILED The method has failed to get the position difference of the specified region, but there is no error reported. @n - * In this case, @c xDiff and @c yDiff are returned with @c 0. @n + * In this case, @c xDiff and @c yDiff will be returned with @c 0. @n * It can happen when the detected faces are too small or two video data are different even if they contain the same face. * This is the result of a normal operation. * @remarks The specific error code can be accessed using the GetLastResult() method. diff --git a/inc/FUixVisionFaceRecognitionInfo.h b/inc/FUixVisionFaceRecognitionInfo.h index 59cd8ad..46bad8f 100644 --- a/inc/FUixVisionFaceRecognitionInfo.h +++ b/inc/FUixVisionFaceRecognitionInfo.h @@ -51,8 +51,7 @@ class _FaceRecognizerImpl; * The %FaceRecognitionInfo class encapsulates the information of a face recognized using the FaceRecognizer class by: * - Getting the position of a recognized face. * - Getting the facial features of a recognized face. - * - * For more information on the class features, see Face Detector and Recognizer. + *

For more information on the class features, see Face Detector and Recognizer.

*/ class _OSP_EXPORT_ FaceRecognitionInfo @@ -60,7 +59,7 @@ class _OSP_EXPORT_ FaceRecognitionInfo { public: /** - * This is the default constructor for this class. @n + * This is the default constructor for this class. * The object is not fully constructed after this constructor is called. * For full construction, the Construct() method must be called right after calling this constructor. * diff --git a/inc/FUixVisionFaceRecognizer.h b/inc/FUixVisionFaceRecognizer.h index f74815b..097f9cf 100644 --- a/inc/FUixVisionFaceRecognizer.h +++ b/inc/FUixVisionFaceRecognizer.h @@ -172,13 +172,9 @@ public: * * @since 2.0 * - * @feature %http://tizen.org/feature/vision.face_recognition * @return An error code * @exception E_SUCCESS The method is successful. - * @exception E_UNSUPPORTED_OPERATION The target device does not support the face detection feature. @b Since: @b 2.1 - * For more information, see Application Filtering. - * @remarks Before calling this method, check whether the feature is supported by - * Tizen::System::SystemInfo::GetValue(const Tizen::Base::String&, bool&). + * @exception E_OUT_OF_MEMORY The memory is insufficient. */ result Construct(void); @@ -289,9 +285,9 @@ public: * @exception E_SUCCESS The method is successful. * @exception E_OUT_OF_MEMORY The memory is insufficient. * @exception E_FAILURE A system error has occurred. - * @remarks - * - The specific error code can be accessed using the GetLastResult() method. - * - BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. + * @remarks + * - The specific error code can be accessed using the GetLastResult() method. + * - BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. * @endif */ Tizen::Base::Collection::IList* ExtractFaceInfoFromStillImageN(const Tizen::Graphics::Bitmap& bitmap); @@ -310,13 +306,14 @@ public: * @param[in] byteBuffer The buffer containing the input image data * @param[in] dim The width and height of the input image @n * Both the width and height must be greater than @c 0. - * @param[in] format The color format @n - * @c BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. + * @param[in] format The color format defined by Tizen::Graphics::BitmapPixelFormat * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. * @exception E_OUT_OF_MEMORY The memory is insufficient. * @exception E_FAILURE A system error has occurred. - * @remarks The specific error code can be accessed using the GetLastResult() method. + * @remarks + * - The specific error code can be accessed using the GetLastResult() method. + * - BitmapPixelFormat::BITMAP_PIXEL_FORMAT_R8G8B8A8 is not applicable for this method. */ Tizen::Base::Collection::IList* ExtractFaceInfoFromStillImageN(const Tizen::Base::ByteBuffer& byteBuffer, const Tizen::Graphics::Dimension& dim, Tizen::Graphics::BitmapPixelFormat format); @@ -365,11 +362,9 @@ public: * @param[in] preprocessedFaceBuffer The preprocessed data * @param[in] faceComponentPos The facial information that is obtained from the * FaceDetector::ExtractFaceComponentsN() method @n - * The specified facial information must contain the eye position. @n + * The @c faceComponentPos parameter must contain the eye position. * The position of the eyes must be greater than or equal to @c 0. - * The position of the eyes must be within @c preprocessedFaceBuffer. @n - * If there are wrong values in the specified facial information, the result cannot be guaranteed even if it returns @c E_SUCCESS. @n - * Therefore, be sure not to change the value of facial information after getting it from FaceDetector::ExtractFaceComponentsN(). + * The position of the eyes must be within @c preprocessedFaceBuffer. * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. * @exception E_OUT_OF_MEMORY The memory is insufficient. @@ -377,9 +372,10 @@ public: * @exception E_OPERATION_FAILED The method has failed to extract the facial information but there is no error reported. @n * This can happen when the detected faces are too small or the input data is not clear. * This is the result of a normal operation. - * @remarks The specific error code can be accessed using the GetLastResult() method. + * @remarks + * - The specific error code can be accessed using the GetLastResult() method. + * - If there are wrong values in the @c faceComponentPos, the result cannot be guaranteed even if it returns @c E_SUCCESS. Therefore, be sure not to change the value of @c faceComponentPos after getting it from FaceDetector::ExtractFaceComponentsN(). * @see FaceDetector::PreprocessDataN() - * @see FaceDetector::ExtractFaceComponentsN() */ Tizen::Base::ByteBuffer* ExtractFeatureN(const FaceBuffer& preprocessedFaceBuffer, const FaceComponentsPosition& faceComponentPos); @@ -392,11 +388,9 @@ public: * else @c EYE_STATE_NONE if an exception occurs * @param[in] preprocessedFaceBuffer The preprocessed data * @param[in] faceComponentPos The facial information that is obtained from the FaceDetector::ExtractFaceComponentsN() method @n - * The specified facial information must contain the eye position. @n + * The @c faceComponentPos parameter must contain the eye position. * The position of the eyes must be greater than or equal to @c 0. - * The position of the eyes must be within @c preprocessedFaceBuffer. @n - * If there are wrong values in the specified facial information, the result cannot be guaranteed even if it returns @c E_SUCCESS. @n - * Therefore, be sure not to change the value of facial information after getting it from FaceDetector::ExtractFaceComponentsN(). + * The position of the eyes must be within @c preprocessedFaceBuffer. * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. * @exception E_OUT_OF_MEMORY The memory is insufficient. @@ -404,7 +398,10 @@ public: * @exception E_OPERATION_FAILED The method has failed to detect the eye state but there is no error reported. @n * This can happen when the detected faces are too small or the input data is not clear. * This is the result of a normal operation. - * @remarks The specific error code can be accessed using the GetLastResult() method. + * @remarks + * - The specific error code can be accessed using the GetLastResult() method. + * - If there are wrong values in the @c faceComponentPos, the result cannot be guaranteed even if it returns @c E_SUCCESS. + * Therefore, be sure not to change the value of @c faceComponentPos after getting it from FaceDetector::ExtractFaceComponentsN(). * @see FaceDetector::PreprocessDataN() */ EyeState GetEyeState(const FaceBuffer& preprocessedFaceBuffer, const FaceComponentsPosition& faceComponentPos); @@ -418,11 +415,9 @@ public: * else @c FACIAL_EXPRESSION_NONE if an exception occurs * @param[in] preprocessedFaceBuffer The preprocessed data * @param[in] faceComponentPos The facial information that is obtained from the FaceDetector::ExtractFaceComponentsN() method @n - * The specified facial information must contain the eye position. @n + * The @c faceComponentPos parameter must contain the eye position. * The position of the eyes must be greater than or equal to @c 0. - * The position of the eyes must be within @c preprocessedFaceBuffer. @n - * If there are wrong values in the specified facial information, the result cannot be guaranteed even if it returns @c E_SUCCESS. @n - * Therefore, be sure not to change the value of facial information after getting it from FaceDetector::ExtractFaceComponentsN(). + * The position of the eyes must be within @c preprocessedFaceBuffer. * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid. * @exception E_OUT_OF_MEMORY The memory is insufficient. @@ -431,6 +426,8 @@ public: * This can happen when the detected faces are too small or the input data is not clear. * This is the result of a normal operation. * @remarks The specific error code can be accessed using the GetLastResult() method. + * @remarks If there are wrong values in the @c faceComponentPos, the result cannot be guaranteed even if it returns @c E_SUCCESS. Therefore, + * be sure not to change the value of @c faceComponentPos after getting it from FaceDetector::ExtractFaceComponentsN(). * @see FaceDetector::PreprocessDataN() */ FacialExpression RecognizeExpression(const FaceBuffer& preprocessedFaceBuffer, const FaceComponentsPosition& faceComponentPos); diff --git a/inc/FUixVisionFaceTypes.h b/inc/FUixVisionFaceTypes.h index 3ad2e9f..33c7a4e 100644 --- a/inc/FUixVisionFaceTypes.h +++ b/inc/FUixVisionFaceTypes.h @@ -17,9 +17,9 @@ /** * @file FUixVisionFaceTypes.h - * @brief This is the header file for the declarations of the Vision namespace. + * @brief This is the header file for the declarations of the Tizen::Uix::Vision namespace. * - * This header file contains the declarations of the Vision namespace. + * This header file contains the declarations of the Tizen::Uix::Vision namespace. */ #ifndef _FUIX_VISION_FACE_TYPES_H_ @@ -42,13 +42,13 @@ enum FaceDetectorConfigProperty { /** * The maximum number of faces to detect from a video stream. @n - * This is used when FaceDetector::DetectFacesFromVideoStreamN() is called. + * This will be used when FaceDetector::DetectFacesFromVideoStreamN() is called. */ FACEDETECTOR_MAXNUMBER_VIDEO, /** * The maximum number of faces to detect from a still image. @n - * This is used when FaceDetector::DetectFacesFromStillImageN(const Tizen::Base::ByteBuffer&, const Tizen::Graphics::Dimension&, Tizen::Graphics::BitmapPixelFormat) is called. + * This will be used when FaceDetector::DetectFacesFromStillImageN() is called. */ FACEDETECTOR_MAXNUMBER_IMAGE, @@ -60,7 +60,7 @@ enum FaceDetectorConfigProperty * The value @c 3 is used when FaceDetector::DetectFacesFromVideoStreamN() is called unless it has been changed earlier * using the FaceDetector::SetProperty() method. @n * - * This is used when %FaceDetector::DetectFacesFromVideoStreamN() is called. + * This will be used when %FaceDetector::DetectFacesFromVideoStreamN() is called. */ FACEDETECTOR_SCALE_VIDEO, @@ -69,18 +69,18 @@ enum FaceDetectorConfigProperty * The range is from values @c 1 to @c 3, where the value @c 1 has the longest execution time and @c 3 has * the shortest execution time. The value @c 1 detects small faces. * Therefore, for an application handling images, the value @c 1 is an appropriate option. - * The value @c 1 is used when FaceDetector::DetectFacesFromStillImageN(const Tizen::Base::ByteBuffer&, const Tizen::Graphics::Dimension&, Tizen::Graphics::BitmapPixelFormat) is called unless it has been changed + * The value @c 1 is used when FaceDetector::DetectFacesFromStillImageN() is called unless it has been changed * earlier using the FaceDetector::SetProperty() method. @n * - * This is used when %FaceDetector::DetectFacesFromStillImageN(const %Tizen::Base::ByteBuffer&, const %Tizen::Graphics::Dimension&, %Tizen::Graphics::BitmapPixelFormat) is called. + * This will be used when %FaceDetector::DetectFacesFromStillImageN() is called. */ FACEDETECTOR_SCALE_IMAGE, /** * The maximum number of faces to detect. @n - * The value @c 1 is used when FaceDetector::DetectFacesN() is called unless it has been changed earlier + * The value @c 1 is used when DetectFacesN() is called unless it has been changed earlier * using the FaceDetector::SetProperty() method. @n - * This is used when %FaceDetector::DetectFacesN() is called. + * This will be used when FaceDetector::DetectFacesN() is called. */ FACEDETECTOR_MAXNUMBER_FACES, @@ -91,7 +91,7 @@ enum FaceDetectorConfigProperty * The value @c 3 is used when FaceDetector::DetectFacesN() is called unless it has been changed earlier using * the FaceDetector::SetProperty() method. @n * - * This is used when %FaceDetector::DetectFacesN() is called. + * This will be used when %FaceDetector::DetectFacesN() is called. */ FACEDETECTOR_SCALE_FACTOR, }; @@ -110,13 +110,13 @@ enum FaceRecognizerConfigProperty { /** * The maximum number of faces to extract face information from a video stream. @n - * This is used when FaceRecognizer::ExtractFaceInfoFromVideoStreamN() is called. + * This will be used when FaceRecognizer::ExtractFaceInfoFromVideoStreamN() is called. */ FACERECOGNIZER_MAXNUMBER_VIDEO, /** * The maximum number of faces to extract face information from a still image. @n - * This is used when FaceRecognizer::ExtractFaceInfoFromStillImageN(const Tizen::Base::ByteBuffer&, const Tizen::Graphics::Dimension&, Tizen::Graphics::BitmapPixelFormat) is called. + * This will be used when FaceRecognizer::ExtractFaceInfoFromStillImageN() is called. */ FACERECOGNIZER_MAXNUMBER_IMAGE, @@ -125,10 +125,10 @@ enum FaceRecognizerConfigProperty * The range is from values @c 1 to @c 3, where the value @c 1 has the longest execution time and @c 3 has * the shortest execution time. The value @c 1 detects small faces. * Therefore, for an application using a camera or a video file, the value @c 3 is an appropriate option. - * The value @c 3 is used when FaceRecognizer::ExtractFaceInfoFromVideoStreamN() is called unless it has been changed + * The value @c 3 is used when ExtractFaceInfoFromVideoStreamN() is called unless it has been changed * earlier using the FaceDetector::SetProperty() method. @n * - * This is used when %FaceRecognizer::ExtractFaceInfoFromVideoStreamN() is called. + * This will be used when FaceRecognizer::ExtractFaceInfoFromVideoStreamN() is called. */ FACERECOGNIZER_SCALE_VIDEO, @@ -138,10 +138,10 @@ enum FaceRecognizerConfigProperty * the shortest execution time. * The value @c 1 detects small faces. * Therefore, for an application handling images, the value @c 1 is an appropriate option. - * The value @c 1 is used when FaceRecognizer::ExtractFaceInfoFromStillImageN(const Tizen::Base::ByteBuffer&, const Tizen::Graphics::Dimension&, Tizen::Graphics::BitmapPixelFormat) is called unless it has been changed + * The value @c 1 is used when ExtractFaceInfoFromStillImageN() is called unless it has been changed * earlier using the FaceDetector::SetProperty() method. @n * - * This is used when %FaceRecognizer::ExtractFaceInfoFromStillImageN(const %Tizen::Base::ByteBuffer&, const %Tizen::Graphics::Dimension&, %Tizen::Graphics::BitmapPixelFormat) is called. + * This will be used when FaceRecognizer::ExtractFaceInfoFromStillImageN() is called. */ FACERECOGNIZER_SCALE_IMAGE, }; diff --git a/src/FUixVisionFaceComponentsPosition.cpp b/src/FUixVisionFaceComponentsPosition.cpp index f594a83..f45e7b8 100644 --- a/src/FUixVisionFaceComponentsPosition.cpp +++ b/src/FUixVisionFaceComponentsPosition.cpp @@ -57,7 +57,7 @@ FaceComponentsPosition::FaceComponentsPosition(const Tizen::Graphics::Rectangle& __faceRect.height = faceRect.height; } -FaceComponentsPosition::FaceComponentsPosition(const Tizen::Graphics::Rectangle& faceRect, const Tizen::Graphics::Point& eyeLeft, const Tizen::Graphics::Point& eyeRight) +FaceComponentsPosition::FaceComponentsPosition(const Tizen::Graphics::Rectangle& faceRect, const Tizen::Graphics::Point& eyeRight, const Tizen::Graphics::Point& eyeLeft) : __mouthRect(-1, -1, -1, -1) { __faceRect.x = faceRect.x; diff --git a/src/FUixVisionFaceDetector.cpp b/src/FUixVisionFaceDetector.cpp index 26a8049..a6cb5bb 100644 --- a/src/FUixVisionFaceDetector.cpp +++ b/src/FUixVisionFaceDetector.cpp @@ -270,7 +270,7 @@ FaceDetector::PreprocessDataN(const Tizen::Base::ByteBuffer& byteBuffer, const T pGrayBuf = __pFaceDetectorImpl->ConvertToGrayN(byteBuffer, dim, format); pProcessedData = std::unique_ptr(new (std::nothrow) FaceBuffer(*pGrayBuf, dim)); - SysTryCatch(NID_UIX, pProcessedData.get() != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed." + SysTryCatch(NID_UIX, pProcessedData != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed." , GetErrorMessage(E_OUT_OF_MEMORY)); delete pGrayBuf; diff --git a/src/FUixVisionFaceRecognizer.cpp b/src/FUixVisionFaceRecognizer.cpp index 0a7cc73..2d178cf 100644 --- a/src/FUixVisionFaceRecognizer.cpp +++ b/src/FUixVisionFaceRecognizer.cpp @@ -330,7 +330,7 @@ FaceRecognizer::ExtractFeatureN(const FaceBuffer& preprocessedFaceBuffer, const r = E_OPERATION_FAILED, E_OPERATION_FAILED, "[%s] Fail to extract the facial information.", GetErrorMessage(E_OPERATION_FAILED)); } - return __pFaceRecognizerImpl->ExtractFeatureN(*(preprocessedFaceBuffer.GetBuffer()), resolution, faceRect, eyeLeft, eyeRight); + return __pFaceRecognizerImpl->ExtractFeatureN(*(preprocessedFaceBuffer.GetBuffer()), resolution, faceRect); CATCH: SetLastResult(r); diff --git a/src/FUixVision_FaceDetectorImpl.cpp b/src/FUixVision_FaceDetectorImpl.cpp index 229802d..7c7516f 100644 --- a/src/FUixVision_FaceDetectorImpl.cpp +++ b/src/FUixVision_FaceDetectorImpl.cpp @@ -120,10 +120,11 @@ _FaceDetectorImpl::Construct(void) std::unique_ptr< FaceEngineInfo > pFaceEngineInfo(new (std::nothrow) FaceEngineInfo); SysTryReturn(NID_UIX, pFaceEngineInfo != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + __pFaceEngineInfo = pFaceEngineInfo.release(); + std::unique_ptr< _FaceUtil > pFaceUtil(new (std::nothrow) _FaceUtil); SysTryReturn(NID_UIX, pFaceUtil != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - __pFaceEngineInfo = pFaceEngineInfo.release(); __pFaceUtil = pFaceUtil.release(); return r; @@ -305,7 +306,6 @@ _FaceDetectorImpl::DetectFacesFromBufferN(const Tizen::Base::ByteBuffer& byteBuf result r = E_SUCCESS; int retValue = 0; unsigned char* pImageBuffer = null; - Tizen::Graphics::Rectangle* pRect = null; ClearLastResult(); @@ -347,7 +347,7 @@ _FaceDetectorImpl::DetectFacesFromBufferN(const Tizen::Base::ByteBuffer& byteBuf { for (int i = 0; i < __pFaceEngineInfo->g_iFaceDetectNum; i++) { - pRect = + Tizen::Graphics::Rectangle* pRect = new (std::nothrow) Tizen::Graphics::Rectangle(__pFaceEngineInfo->g_FaceROI[i].x, __pFaceEngineInfo->g_FaceROI[i].y, __pFaceEngineInfo->g_FaceROI[i].width, __pFaceEngineInfo->g_FaceROI[i].height); @@ -362,12 +362,8 @@ _FaceDetectorImpl::DetectFacesFromBufferN(const Tizen::Base::ByteBuffer& byteBuf return pDetectList.release(); CATCH: - if (pRect != null) - { - delete pRect; - } SetLastResult(r); - pDetectList->RemoveAll(true); + pDetectList->RemoveAll(); return pDetectList.release(); } @@ -378,7 +374,6 @@ _FaceDetectorImpl::DetectFacesFromBitmapN(const Tizen::Graphics::Bitmap& bitmap) BufferInfo bitmapInfo; unsigned char* pImageBuffer = null; int retValue = 0; - Tizen::Graphics::Rectangle* pRect = null; ClearLastResult(); @@ -424,9 +419,7 @@ _FaceDetectorImpl::DetectFacesFromBitmapN(const Tizen::Graphics::Bitmap& bitmap) { for (int i = 0; i < __pFaceEngineInfo->g_iFaceDetectNum; i++) { - //The null assingment is to avoid possible memory leak - pRect = null; - pRect = + Tizen::Graphics::Rectangle* pRect = new (std::nothrow) Tizen::Graphics::Rectangle(__pFaceEngineInfo->g_FaceROI[i].x, __pFaceEngineInfo->g_FaceROI[i].y, __pFaceEngineInfo->g_FaceROI[i].width, __pFaceEngineInfo->g_FaceROI[i].height); @@ -448,13 +441,10 @@ _FaceDetectorImpl::DetectFacesFromBitmapN(const Tizen::Graphics::Bitmap& bitmap) return pDetectList.release(); CATCH: - if (pRect) - { - delete pRect; - } + SysLogException(NID_UIX, r, "XXXX - CATCH: _FaceDetectorImpl::DetectFacesFromBitmapN"); ReleaseFaceEngine(); SetLastResult(r); - pDetectList->RemoveAll(true); + pDetectList->RemoveAll(); return pDetectList.release(); } @@ -466,7 +456,6 @@ _FaceDetectorImpl::DetectFacesFromBitmapN(const Tizen::Base::ByteBuffer& byteBuf result r = E_SUCCESS; int retValue = 0; unsigned char* pImageBuffer = null; - Tizen::Graphics::Rectangle* pRect = null; std::unique_ptr< unsigned char[] > pBuffer(new (std::nothrow) unsigned char[resolution.width * resolution.height]); SysTryReturn(NID_UIX, pBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed." @@ -507,9 +496,7 @@ _FaceDetectorImpl::DetectFacesFromBitmapN(const Tizen::Base::ByteBuffer& byteBuf { for (int i = 0; i < __pFaceEngineInfo->g_iFaceDetectNum; i++) { - //The null assingment is to avoid possible memory leak - pRect = null; - pRect = + Tizen::Graphics::Rectangle* pRect = new (std::nothrow) Tizen::Graphics::Rectangle(__pFaceEngineInfo->g_FaceROI[i].x, __pFaceEngineInfo->g_FaceROI[i].y, __pFaceEngineInfo->g_FaceROI[i].width, __pFaceEngineInfo->g_FaceROI[i].height); @@ -526,13 +513,9 @@ _FaceDetectorImpl::DetectFacesFromBitmapN(const Tizen::Base::ByteBuffer& byteBuf return pDetectList.release(); CATCH: - if (pRect) - { - delete pRect; - } SetLastResult(r); ReleaseFaceEngine(); - pDetectList->RemoveAll(true); + pDetectList->RemoveAll(); return pDetectList.release(); } @@ -542,14 +525,12 @@ _FaceDetectorImpl::ConvertToGrayN(const Tizen::Base::ByteBuffer& byteBuffer, con { result r = E_SUCCESS; ClearLastResult(); - int capacity = 0; std::unique_ptr< Tizen::Base::ByteBuffer > pGrayBuf(new (std::nothrow) Tizen::Base::ByteBuffer()); SysTryReturn(NID_UIX, pGrayBuf != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed." , GetErrorMessage(E_OUT_OF_MEMORY)); - capacity = byteBuffer.GetCapacity(); - r = pGrayBuf->Construct(capacity); + r = pGrayBuf->Construct(resolution.width * resolution.height); SysTryReturn(NID_UIX, r == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(r)); switch (format) @@ -565,7 +546,8 @@ _FaceDetectorImpl::ConvertToGrayN(const Tizen::Base::ByteBuffer& byteBuffer, con break; case PIXEL_FORMAT_YCbCr420_PLANAR: - memcpy((unsigned char*)(pGrayBuf->GetPointer()), (unsigned char*)(byteBuffer.GetPointer()), capacity); + memcpy((unsigned char*) (pGrayBuf->GetPointer()), + (unsigned char*) byteBuffer.GetPointer(), sizeof(unsigned char) * resolution.width * resolution.height); break; default: @@ -583,7 +565,6 @@ _FaceDetectorImpl::DetectFacesN(const Tizen::Base::ByteBuffer& grayBuffer, const int retValue = 0; result r = E_SUCCESS; unsigned char* pImageBuffer = null; - Tizen::Graphics::Rectangle* pRect = null; ClearLastResult(); @@ -618,9 +599,7 @@ _FaceDetectorImpl::DetectFacesN(const Tizen::Base::ByteBuffer& grayBuffer, const { for (int i = 0; i < __pFaceEngineInfo->g_iFaceDetectNum; i++) { - //The null assingment is to avoid possible memory leak - pRect = null; - pRect = + Tizen::Graphics::Rectangle* pRect = new (std::nothrow) Tizen::Graphics::Rectangle(__pFaceEngineInfo->g_FaceROI[i].x, __pFaceEngineInfo->g_FaceROI[i].y, __pFaceEngineInfo->g_FaceROI[i].width, __pFaceEngineInfo->g_FaceROI[i].height); @@ -635,12 +614,9 @@ _FaceDetectorImpl::DetectFacesN(const Tizen::Base::ByteBuffer& grayBuffer, const ReleaseFaceEngine(); return pDetectList.release(); CATCH: - if (pRect) - { - delete pRect; - } + SysLogException(NID_UIX, r, "XXXX - CATCH _FaceDetectorImpl::DetectFacesN"); SetLastResult(r); - pDetectList->RemoveAll(true); + pDetectList->RemoveAll(); return pDetectList.release(); } @@ -650,6 +626,7 @@ _FaceDetectorImpl::ExtractFaceComponents(const Tizen::Base::ByteBuffer& grayBuff Tizen::Graphics::Point& eyeLeft, Tizen::Graphics::Rectangle& mouthRect) { result r = E_SUCCESS; + int index = -1; int retVal = 0; FaceEngineInfo* pFaceEngineInfo = null; diff --git a/src/FUixVision_FaceRecognizerImpl.cpp b/src/FUixVision_FaceRecognizerImpl.cpp index b65a6c1..f7e2923 100644 --- a/src/FUixVision_FaceRecognizerImpl.cpp +++ b/src/FUixVision_FaceRecognizerImpl.cpp @@ -105,10 +105,14 @@ _FaceRecognizerImpl::Construct(void) std::unique_ptr< FaceEngineInfo > pFaceEngineInfo(new (std::nothrow) FaceEngineInfo); SysTryReturn(NID_UIX, pFaceEngineInfo != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + __pFaceEngineInfo = pFaceEngineInfo.release(); + + //int retValue = caApp_FaceEngineInit(__pFaceEngineInfo, FD_MODE_ROLo_YAWo, FD_SIZE_COVERAGE_HIGH,__maxFacesImage, _FT_INTERVAL_DEFAULT); + //SysTryReturn(NID_UIX, retValue == _FACEENGINE_INIT_SUCCESS, E_FAILURE, E_FAILURE, "[%s] Face Engine Init failed.", GetErrorMessage(E_FAILURE)); + std::unique_ptr< _FaceUtil > pFaceUtil(new (std::nothrow) _FaceUtil); SysTryReturn(NID_UIX, pFaceUtil != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - __pFaceEngineInfo = pFaceEngineInfo.release(); __pFaceUtil = pFaceUtil.release(); return res; @@ -319,6 +323,7 @@ _FaceRecognizerImpl::ExtractFaceFeaturesFromBufferN(const Tizen::Base::ByteBuffe int featureLength = 0; unsigned char* pImageBuffer = null; ByteBuffer buffer; + int isValidFREngine = 0; std::unique_ptr< FaceRecognitionInfo > pFaceInfo; @@ -368,7 +373,10 @@ _FaceRecognizerImpl::ExtractFaceFeaturesFromBufferN(const Tizen::Base::ByteBuffe , GetErrorMessage(E_FAILURE)); } - caApp_FtsExInit(FR_MODE_MPL2, _FACE_ENGINE_BIN_PATH); + //isValidFREngine = caApp_FtsExInit(FR_MODE_MPL2, "/usr/share/face-engine/data/"); + isValidFREngine = caApp_FtsExInit(FR_MODE_MPL2, _FACE_ENGINE_BIN_PATH); + + //SysTryCatch(NID_UIX, isValidFREngine == _FACEENGINE_RETURN_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed caApp_FtsExInit", GetErrorMessage(E_FAILURE)); featureLength = caApp_FtsExVecLength(); SysTryCatch(NID_UIX, featureLength > 0, r = E_FAILURE, E_FAILURE, "[%s] Failed caApp_FtsExInit", GetErrorMessage(E_FAILURE)); @@ -405,7 +413,7 @@ _FaceRecognizerImpl::ExtractFaceFeaturesFromBufferN(const Tizen::Base::ByteBuffe CATCH: SetLastResult(r); caApp_FtsExRelease(); - pDetectList->RemoveAll(true); + pDetectList->RemoveAll(); return pDetectList.release(); } @@ -419,6 +427,7 @@ _FaceRecognizerImpl::ExtractFaceFeaturesFromBitmapN(const Tizen::Base::ByteBuffe result r = E_SUCCESS; unsigned char* pImageBuffer = null; int retValue = 0; + int isValidFREngine = 0; int featureLength = 0; std::unique_ptr< FaceRecognitionInfo > pFaceInfo; @@ -466,7 +475,9 @@ _FaceRecognizerImpl::ExtractFaceFeaturesFromBitmapN(const Tizen::Base::ByteBuffe , GetErrorMessage(E_FAILURE)); } - caApp_FtsExInit(FR_MODE_MPL2, _FACE_ENGINE_BIN_PATH); + //isValidFREngine = caApp_FtsExInit(FR_MODE_MPL2,"/usr/share/face-engine/data/"); + isValidFREngine = caApp_FtsExInit(FR_MODE_MPL2, _FACE_ENGINE_BIN_PATH); + //SysTryCatch(NID_UIX, isValidFREngine == _FACEENGINE_RETURN_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed caApp_FtsExInit", GetErrorMessage(E_FAILURE)); featureLength = caApp_FtsExVecLength(); SysTryCatch(NID_UIX, featureLength > 0, r = E_FAILURE, E_FAILURE, "[%s] Failed caApp_FtsExInit", GetErrorMessage(E_FAILURE)); @@ -505,7 +516,7 @@ CATCH: SetLastResult(r); caApp_FtsExRelease(); ReleaseFaceEngine(); - pDetectList->RemoveAll(true); + pDetectList->RemoveAll(); return pDetectList.release(); } @@ -516,6 +527,7 @@ _FaceRecognizerImpl::ExtractFaceFeaturesFromBitmapN(const Tizen::Graphics::Bitma result r = E_SUCCESS; unsigned char* pImageBuffer = null; int retValue = 0; + int isValidFREngine = 0; int featureLength = 0; std::unique_ptr< FaceRecognitionInfo > pFaceInfo; @@ -564,7 +576,9 @@ _FaceRecognizerImpl::ExtractFaceFeaturesFromBitmapN(const Tizen::Graphics::Bitma , GetErrorMessage(E_FAILURE)); } - caApp_FtsExInit(FR_MODE_MPL2, _FACE_ENGINE_BIN_PATH); + //isValidFREngine = caApp_FtsExInit(FR_MODE_MPL2,"/usr/share/face-engine/data/"); + isValidFREngine = caApp_FtsExInit(FR_MODE_MPL2, _FACE_ENGINE_BIN_PATH); + //SysTryCatch(NID_UIX, isValidFREngine == _FACEENGINE_RETURN_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed caApp_FtsExInit", GetErrorMessage(E_FAILURE)); featureLength = caApp_FtsExVecLength(); SysTryCatch(NID_UIX, featureLength > 0, r = E_FAILURE, E_FAILURE, "[%s] Failed caApp_FtsExInit", GetErrorMessage(E_FAILURE)); @@ -597,10 +611,10 @@ _FaceRecognizerImpl::ExtractFaceFeaturesFromBitmapN(const Tizen::Graphics::Bitma pFaceInfo->SetFacePosition(pRect->x, pRect->y, pRect->width, pRect->height); - delete pRect; - r = pDetectList->Add(*(pFaceInfo.release())); SysTryCatch(NID_UIX, r == E_SUCCESS, r = E_FAILURE, r, "[%s] Failed to add the FaceRecognitionInfo.", GetErrorMessage(E_FAILURE)); + + delete pRect; } caApp_FtsExRelease(); @@ -614,7 +628,7 @@ CATCH: SetLastResult(r); caApp_FtsExRelease(); ReleaseFaceEngine(); - pDetectList->RemoveAll(true); + pDetectList->RemoveAll(); return pDetectList.release(); } @@ -668,7 +682,7 @@ _FaceRecognizerImpl::DetectBlinksFromBitmapN(const Tizen::Base::ByteBuffer& byte pDetectList(new (std::nothrow) HashMapT< Tizen::Graphics::Rectangle, EyeState >); SysTryReturn(NID_UIX, pDetectList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - std::unique_ptr< unsigned char[] > pBuffer(new (std::nothrow) unsigned char[resolution.width * resolution.height]); + std::unique_ptr< unsigned char > pBuffer(new (std::nothrow) unsigned char[resolution.width * resolution.height]); SysTryCatch(NID_UIX, pBuffer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pImageBuffer = pBuffer.get(); @@ -745,6 +759,7 @@ _FaceRecognizerImpl::DetectBlinksFromBitmapN(const Tizen::Base::ByteBuffer& byte return pDetectList.release(); CATCH: + SysLogException(NID_UIX, E_SUCCESS, "XXXX - CATCH _FaceRecognizerImpl::DetectBlinksFromBitmapN-"); SetLastResult(r); ReleaseFaceEngine(); pDetectList->RemoveAll(); @@ -776,7 +791,7 @@ _FaceRecognizerImpl::RecognizeExpressionsFromBitmapN(const Tizen::Base::ByteBuff pDetectList(new (std::nothrow) HashMapT< Tizen::Graphics::Rectangle, FacialExpression >); SysTryReturn(NID_UIX, pDetectList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - std::unique_ptr< unsigned char[] > pBuffer(new (std::nothrow) unsigned char[resolution.width * resolution.height]); + std::unique_ptr< unsigned char > pBuffer(new (std::nothrow) unsigned char[resolution.width * resolution.height]); SysTryCatch(NID_UIX, pBuffer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); pImageBuffer = pBuffer.get(); SysTryCatch(NID_UIX, pImageBuffer != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Failed to create the Buffer.", @@ -864,6 +879,7 @@ _FaceRecognizerImpl::RecognizeExpressionsFromBitmapN(const Tizen::Base::ByteBuff return pDetectList.release(); CATCH: + SysLogException(NID_UIX, E_SUCCESS, "XXXX - CATCH _FaceRecognizerImpl::RecognizeExpressionsFromBitmapN-"); ReleaseFaceEngine(); SetLastResult(r); pDetectList->RemoveAll(); @@ -927,7 +943,11 @@ _FaceRecognizerImpl::DetectBlinksFromBufferN(const Tizen::Base::ByteBuffer& byte , GetErrorMessage(E_FAILURE)); } + SysLogException(NID_UIX, E_SUCCESS, "XXXX - REACH 001"); + retValue = caApp_RunFaceDetection(pImageBuffer, resolution.width, resolution.height, __pFaceEngineInfo); + SysLogException(NID_UIX, E_SUCCESS, "XXXX - REACH 002 __pFaceEngineInfo->g_iFaceDetectNum = %d", __pFaceEngineInfo->g_iFaceDetectNum); + SysTryCatch(NID_UIX, retValue == _FACEENGINE_RETURN_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed to create the Buffer." , GetErrorMessage(E_FAILURE)); for (int i = 0; i < __pFaceEngineInfo->g_iFaceDetectNum; i++) @@ -1034,19 +1054,23 @@ _FaceRecognizerImpl::RecognizeExpressionsFromBufferN(const Tizen::Base::ByteBuff SysTryCatch(NID_UIX, retValue == _FACEENGINE_RETURN_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed to create the Buffer." , GetErrorMessage(E_FAILURE)); + //SysLogException(NID_UIX, E_SUCCESS, "XXXX - Entering RecognizeExpressionsFromBufferN faces= %d",__pFaceEngineInfo->g_iFaceDetectNum); for (int i = 0; i < __pFaceEngineInfo->g_iFaceDetectNum; i++) { retValue = caApp_RunEyeDetection(pImageBuffer, resolution.width, resolution.height, __pFaceEngineInfo, i); SysTryCatch(NID_UIX, retValue == _FACEENGINE_RETURN_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed to create the Buffer." , GetErrorMessage(E_FAILURE)); + SysLogException(NID_UIX, E_SUCCESS, "XXXX - REACH 003"); retValue = caApp_RunMouthDetection(pImageBuffer, resolution.width, resolution.height, __pFaceEngineInfo, i); SysTryCatch(NID_UIX, retValue == _FACEENGINE_RETURN_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed to create the Buffer." , GetErrorMessage(E_FAILURE)); + SysLogException(NID_UIX, E_SUCCESS, "XXXX - REACH 004"); retValue = caApp_RunFERDetection(pImageBuffer, resolution.width, resolution.height, __pFaceEngineInfo, true); SysTryCatch(NID_UIX, retValue == _FACEENGINE_RETURN_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed to create the Buffer." , GetErrorMessage(E_FAILURE)); + SysLogException(NID_UIX, E_SUCCESS, "XXXX - REACH 005"); FacialExpression expression = FACIAL_EXPRESSION_NONE; switch (*(__pFaceEngineInfo->g_Expression[i])) @@ -1082,6 +1106,7 @@ _FaceRecognizerImpl::RecognizeExpressionsFromBufferN(const Tizen::Base::ByteBuff return pDetectList.release(); CATCH: + //SysLogException(NID_UIX, r, "XXXX -CATCH _FaceRecognizerImpl::RecognizeExpressionsFromBufferN-"); pDetectList->RemoveAll(); SetLastResult(r); return pDetectList.release(); @@ -1089,13 +1114,13 @@ CATCH: Tizen::Base::ByteBuffer* _FaceRecognizerImpl::ExtractFeatureN(const Tizen::Base::ByteBuffer& grayBuffer, const Tizen::Graphics::Dimension& resolution, - const Tizen::Graphics::Rectangle& faceRect, Tizen::Graphics::Point eyeLeft, - Tizen::Graphics::Point eyeRight) + const Tizen::Graphics::Rectangle& faceRect) { ClearLastResult(); result r = E_SUCCESS; int featureLength = 0; int retValue = 0; + int isValidFREngine = 0; long* pFaceData = null; FaceEngineInfo* __pFaceEngineInfoTemp = null; @@ -1103,10 +1128,8 @@ _FaceRecognizerImpl::ExtractFeatureN(const Tizen::Base::ByteBuffer& grayBuffer, SysTryReturn(NID_UIX, pBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); std::unique_ptr< FaceEngineInfo > pFaceEngineInfo(new (std::nothrow) FaceEngineInfo); - SysTryReturn(NID_UIX, pFaceEngineInfo != null, null, E_OUT_OF_MEMORY, "[%s] Failed to create the Buffer.", GetErrorMessage(E_OUT_OF_MEMORY)); - __pFaceEngineInfoTemp = pFaceEngineInfo.get(); - SysTryReturn(NID_UIX, __pFaceEngineInfoTemp != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + __pFaceEngineInfoTemp = pFaceEngineInfo.release(); retValue = caApp_FaceEngineInit(__pFaceEngineInfoTemp, FD_MODE_ROLx_YAWx, FD_SIZE_COVERAGE_HIGH, __maxFacesImage, 20); SysTryCatch(NID_UIX, retValue == _FACEENGINE_INIT_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed to create the Buffer." @@ -1116,12 +1139,11 @@ _FaceRecognizerImpl::ExtractFeatureN(const Tizen::Base::ByteBuffer& grayBuffer, __pFaceEngineInfoTemp->g_FaceROI[0].y = faceRect.y; __pFaceEngineInfoTemp->g_FaceROI[0].width = faceRect.width; __pFaceEngineInfoTemp->g_FaceROI[0].height = faceRect.height; - __pFaceEngineInfoTemp->g_EyeROI[0].lx = eyeLeft.x; - __pFaceEngineInfoTemp->g_EyeROI[0].ly = eyeLeft.y; - __pFaceEngineInfoTemp->g_EyeROI[0].rx = eyeRight.x; - __pFaceEngineInfoTemp->g_EyeROI[0].ry = eyeRight.y; - caApp_FtsExInit(FR_MODE_MPL2, _FACE_ENGINE_BIN_PATH); + //caApp_RunFaceDetection((unsigned char*)grayBuffer, resolution.width, resolution.height, __pFaceEngineInfoTemp); + //isValidFREngine = caApp_FtsExInit(FR_MODE_MPL2,"/usr/share/face-engine/data/"); + isValidFREngine = caApp_FtsExInit(FR_MODE_MPL2, _FACE_ENGINE_BIN_PATH); + //SysTryCatch(NID_UIX, isValidFREngine == _FACEENGINE_RETURN_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed caApp_FtsExInit", GetErrorMessage(E_FAILURE)); featureLength = caApp_FtsExVecLength(); SysTryCatch(NID_UIX, featureLength > 0, r = E_FAILURE, E_FAILURE, "[%s] Failed caApp_FtsExInit", GetErrorMessage(E_FAILURE)); @@ -1141,8 +1163,8 @@ _FaceRecognizerImpl::ExtractFeatureN(const Tizen::Base::ByteBuffer& grayBuffer, SysTryCatch(NID_UIX, retValue == _FACEENGINE_INIT_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed to delete FaceEngine.", GetErrorMessage(E_FAILURE)); return pBuffer.release(); - CATCH: + SysLogException(NID_UIX, E_SUCCESS, "XXXX - CATCH _FaceRecognizerImpl::ExtractFeatureN-"); caApp_FtsExRelease(); caApp_FaceEngineRelease(__pFaceEngineInfoTemp); SetLastResult(r); @@ -1163,13 +1185,9 @@ _FaceRecognizerImpl::DetectEyeState(const Tizen::Base::ByteBuffer& grayBuffer, c //Way to get the index is to loop for all rects and get the index.. std::unique_ptr< FaceEngineInfo > pFaceEngineInfo(new (std::nothrow) FaceEngineInfo); - SysTryReturn(NID_UIX, pFaceEngineInfo != null, eyeState, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - __pFaceEngineInfoTemp = pFaceEngineInfo.get(); - SysTryReturn(NID_UIX, __pFaceEngineInfoTemp != null, eyeState, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + __pFaceEngineInfoTemp = pFaceEngineInfo.release(); - retVal = caApp_FaceEngineInit(__pFaceEngineInfoTemp, FD_MODE_ROLx_YAWx, FD_SIZE_COVERAGE_HIGH,__maxFacesImage, 20); - SysTryCatch(NID_UIX, retVal == _FACEENGINE_INIT_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed to create the Buffer." - , GetErrorMessage(E_FAILURE)); + caApp_FaceEngineInit(__pFaceEngineInfoTemp, FD_MODE_ROLx_YAWx, FD_SIZE_COVERAGE_HIGH, __maxFacesImage, 20); __pFaceEngineInfoTemp->g_FaceROI[0].x = faceRect.x; __pFaceEngineInfoTemp->g_FaceROI[0].y = faceRect.y; @@ -1202,8 +1220,8 @@ _FaceRecognizerImpl::DetectEyeState(const Tizen::Base::ByteBuffer& grayBuffer, c SysTryCatch(NID_UIX, retVal == _FACEENGINE_INIT_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed to delete FaceEngine.", GetErrorMessage(E_FAILURE)); return eyeState; - CATCH: + SysLogException(NID_UIX, E_SUCCESS, "XXXX - CATCH _FaceRecognizerImpl::DetectEyeState"); caApp_FaceEngineRelease(__pFaceEngineInfoTemp); SetLastResult(r); return EYE_STATE_NONE; @@ -1220,14 +1238,10 @@ _FaceRecognizerImpl::RecognizeExpression(const Tizen::Base::ByteBuffer& grayBuff FaceEngineInfo* __pFaceEngineInfoTemp = null; std::unique_ptr< FaceEngineInfo > pFaceEngineInfo(new (std::nothrow) FaceEngineInfo); - SysTryReturn(NID_UIX, pFaceEngineInfo != null, expression, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); - __pFaceEngineInfoTemp = pFaceEngineInfo.get(); - SysTryReturn(NID_UIX, __pFaceEngineInfoTemp != null, expression, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY)); + __pFaceEngineInfoTemp = pFaceEngineInfo.release(); - retVal = caApp_FaceEngineInit(__pFaceEngineInfoTemp, FD_MODE_ROLx_YAWx, FD_SIZE_COVERAGE_HIGH,__maxFacesImage, 20); - SysTryCatch(NID_UIX, retVal == _FACEENGINE_INIT_SUCCESS, r = E_FAILURE, E_FAILURE, "[%s] Failed to create the Buffer." - , GetErrorMessage(E_FAILURE)); + caApp_FaceEngineInit(__pFaceEngineInfoTemp, FD_MODE_ROLx_YAWx, FD_SIZE_COVERAGE_HIGH, __maxFacesImage, 20); __pFaceEngineInfoTemp->g_FaceROI[0].x = faceRect.x; __pFaceEngineInfoTemp->g_FaceROI[0].y = faceRect.y; @@ -1274,6 +1288,7 @@ _FaceRecognizerImpl::RecognizeExpression(const Tizen::Base::ByteBuffer& grayBuff return expression; CATCH: + SysLogException(NID_UIX, E_SUCCESS, "XXXX -CATCH _FaceRecognizerImpl::RecognizeExpression"); caApp_FaceEngineRelease(__pFaceEngineInfoTemp); SetLastResult(r); return FACIAL_EXPRESSION_NONE; diff --git a/src/FUixVision_FaceRecognizerImpl.h b/src/FUixVision_FaceRecognizerImpl.h index efd20bd..d122826 100644 --- a/src/FUixVision_FaceRecognizerImpl.h +++ b/src/FUixVision_FaceRecognizerImpl.h @@ -289,8 +289,7 @@ public: * It can be happened when the detected faces are too small or the image is not clear. @n * This is the result of a normal operation. @n */ - Tizen::Base::ByteBuffer* ExtractFeatureN(const Tizen::Base::ByteBuffer& grayBuffer, const Tizen::Graphics::Dimension& resolution, const Tizen::Graphics::Rectangle& faceRect, - Tizen::Graphics::Point eyeLeft, Tizen::Graphics::Point eyeRight); + Tizen::Base::ByteBuffer* ExtractFeatureN(const Tizen::Base::ByteBuffer& grayBuffer, const Tizen::Graphics::Dimension& resolution, const Tizen::Graphics::Rectangle& faceRect); /** * Extracts the eye state. diff --git a/src/FUixVision_FaceUtil.cpp b/src/FUixVision_FaceUtil.cpp index cde82e0..006685e 100644 --- a/src/FUixVision_FaceUtil.cpp +++ b/src/FUixVision_FaceUtil.cpp @@ -89,6 +89,7 @@ _FaceUtil::ConvertRgb565ToGray(const unsigned char& buf, unsigned char* pGrayBuf void _FaceUtil::ConvertArgb8888ToGray(const unsigned char& buf, unsigned char* pGrayBuf, int width, int height) { + SysAssert(pGrayBuf != null); if (pGrayBuf == null) { return; diff --git a/src/caBasicDef.h b/src/caBasicDef.h index 9fe6d7c..1b342ae 100644 --- a/src/caBasicDef.h +++ b/src/caBasicDef.h @@ -1,20 +1,3 @@ -// -// Open Service Platform -// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.1 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - #ifndef _CA_BASIC_INFO_DEF_H_ #define _CA_BASIC_INFO_DEF_H_ diff --git a/src/caBasicDef_ENUM.h b/src/caBasicDef_ENUM.h index 29aeb4b..a9f1701 100644 --- a/src/caBasicDef_ENUM.h +++ b/src/caBasicDef_ENUM.h @@ -1,20 +1,3 @@ -// -// Open Service Platform -// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.1 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - #ifndef _CA_BASIC_INFO_DEF_ENUM_H_ #define _CA_BASIC_INFO_DEF_ENUM_H_ diff --git a/src/caFaceAPP_interface.h b/src/caFaceAPP_interface.h index 1096340..99fd4a5 100644 --- a/src/caFaceAPP_interface.h +++ b/src/caFaceAPP_interface.h @@ -1,20 +1,3 @@ -// -// Open Service Platform -// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.1 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - #ifndef _CA_FACE_APP_INTERFACE_H_ #define _CA_FACE_APP_INTERFACE_H_