Migration with OpenCV-4.2.0
authorTae-Young Chung <ty83.chung@samsung.com>
Thu, 2 Jan 2020 08:28:05 +0000 (17:28 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Tue, 7 Jan 2020 11:03:20 +0000 (20:03 +0900)
Change-Id: Ib547582b318c1d33bc0e4d9579d9f64c30685f76

1  2 
mv_face/face/src/FaceExpressionRecognizer.cpp
mv_face/face/src/mv_face_open.cpp
packaging/capi-media-vision.spec

index 54f5309c7398471993e62125eb11bdba8009f5e8,54f5309c7398471993e62125eb11bdba8009f5e8..973b8c9414c1742ef91befa2713536fb65154e5c
@@@ -29,7 -29,7 +29,7 @@@ static const int MIN_DETECTION_HEIGHT 
  
  FaceRecognizerConfig::FaceRecognizerConfig() :
                mHaarcascadeFilepath(
--                              "/usr/share/OpenCV/haarcascades/haarcascade_smile.xml")
++                              "/usr/share/opencv4/haarcascades/haarcascade_smile.xml")
  {
        ; /* NULL */
  }
index 337b8b84ae5083fdae7cbb3fcdd50904655493c2,443fd715323a37d819eb384e2cef524ff8e8cdeb..66764926b1aaded5c292d37ff9422160ed8ac94a
@@@ -84,36 -86,33 +86,33 @@@ int mv_face_detect_open
                return error;
        }
  
-       char *haarcascadeFilepath;
-       error = mv_engine_config_get_string_attribute_c(
-                                       engine_cfg,
-                                       "MV_FACE_DETECTION_MODEL_FILE_PATH",
-                                       &haarcascadeFilepath);
        /* default path */
+       cv::Size minSize(0, 0);
+       cv::Rect roi(-1, -1, -1, -1);
        std::string haarcascadeFilePathStr =
--                      "/usr/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml";
++                      "/usr/share/opencv4/haarcascades/haarcascade_frontalface_alt2.xml";
+       if (engine_cfg) {
+               int minWidth, minHeight;
  
-       if (error == MEDIA_VISION_ERROR_NONE) {
-               LOGI("Haarcascade file was set as default");
-               haarcascadeFilePathStr = std::string(haarcascadeFilepath);
-               free(haarcascadeFilepath);
-               haarcascadeFilepath = NULL;
-       } else {
-               LOGE("Error occurred during face detection haarcascade file receiving."
+               /* set face detection model */
+               char *haarcascadeFilepath;
+               error = mv_engine_config_get_string_attribute_c(
+                               engine_cfg,
+                               "MV_FACE_DETECTION_MODEL_FILE_PATH",
+                               &haarcascadeFilepath);
+               if (error == MEDIA_VISION_ERROR_NONE) {
+                       LOGI("Haarcascade file was set as default");
+                       haarcascadeFilePathStr = std::string(haarcascadeFilepath);
+                       free(haarcascadeFilepath);
+                       haarcascadeFilepath = NULL;
+               } else {
+                       LOGE("Error occurred during face detection haarcascade file receiving."
                                " (%i)", error);
-       }
+               }
  
-       static FaceDetector faceDetector;
-       if (!faceDetector.loadHaarcascade(haarcascadeFilePathStr)) {
-               LOGE("Loading Haarcascade failed");
-               return MEDIA_VISION_ERROR_INVALID_PARAMETER;
-       }
-       cv::Rect roi(-1, -1, -1, -1);
-       error = mv_engine_config_get_int_attribute_c(
+               /* Ser roi to be detected */
+               error = mv_engine_config_get_int_attribute_c(
                                engine_cfg,
                                MV_FACE_DETECTION_ROI_X,
                                &roi.x);
index 6c761b853bc63e68b412ac30577c38eee35495c8,d8869f0a394ff835d2171bea9b5fc9e0b4f72749..34732406f3a646c255f0d746cffb7f1173c25147
@@@ -10,7 -10,8 +10,7 @@@ BuildRequires: pkgconfig(capi-media-too
  BuildRequires: pkgconfig(libtbm)
  BuildRequires: pkgconfig(dlog)
  BuildRequires: pkgconfig(capi-system-info)
- BuildRequires: pkgconfig(opencv) >= 3.4.0
 -#BuildRequires: pkgconfig(opencv) >= 3.4.1
+ BuildRequires: pkgconfig(opencv4)
  BuildRequires: pkgconfig(zbar)
  BuildRequires: pkgconfig(glib-2.0)
  # Change to the pkgconfig(zint) after zint package refactor