summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis de Bethencourt <luis@debethencourt.com>2015-08-17 17:38:15 +0100
committerLuis de Bethencourt <luis@debethencourt.com>2015-08-17 18:05:50 +0100
commit07ee52db5dbddf35ab22199a1960e9f5cc8aae73 (patch)
tree8b2a6d4e511dfbfa45849dac5656906c31132657
parentdce7ffb04efb30762b7282436ab91eb4a8ea6250 (diff)
downloadgstreamer-plugins-bad-07ee52db5dbddf35ab22199a1960e9f5cc8aae73.tar.gz
opencv: support alternative path convention
Some distributions store OpenCV files in /usr/share/opencv and some others (and default when building from source) install them in /usr/share/OpenCV. Support both to find cascade files. https://bugzilla.gnome.org/show_bug.cgi?id=753651
-rw-r--r--configure.ac3
-rw-r--r--ext/opencv/gstfaceblur.c2
-rw-r--r--ext/opencv/gstfacedetect.cpp2
3 files changed, 5 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 10d39373d..cc076de69 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2487,6 +2487,9 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [
AC_SUBST(OPENCV_PREFIX)
AC_SUBST(OPENCV_CFLAGS)
AC_SUBST(OPENCV_LIBS)
+ AC_CHECK_FILE([$OPENCV_PREFIX/share/opencv/],
+ [AC_DEFINE_UNQUOTED(OPENCV_PATH_NAME, ["opencv"], [OpenCV path name])],
+ [AC_DEFINE_UNQUOTED(OPENCV_PATH_NAME, ["OpenCV"], [OpenCV path name])])
])
dnl *** OpenEXR ***
diff --git a/ext/opencv/gstfaceblur.c b/ext/opencv/gstfaceblur.c
index 0cbe75633..e06a82c9c 100644
--- a/ext/opencv/gstfaceblur.c
+++ b/ext/opencv/gstfaceblur.c
@@ -71,7 +71,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_face_blur_debug);
#define GST_CAT_DEFAULT gst_face_blur_debug
#define DEFAULT_PROFILE OPENCV_PREFIX G_DIR_SEPARATOR_S "share" \
- G_DIR_SEPARATOR_S "opencv" G_DIR_SEPARATOR_S "haarcascades" \
+ G_DIR_SEPARATOR_S OPENCV_PATH_NAME G_DIR_SEPARATOR_S "haarcascades" \
G_DIR_SEPARATOR_S "haarcascade_frontalface_default.xml"
#define DEFAULT_SCALE_FACTOR 1.25
#define DEFAULT_FLAGS CV_HAAR_DO_CANNY_PRUNING
diff --git a/ext/opencv/gstfacedetect.cpp b/ext/opencv/gstfacedetect.cpp
index efad93d21..a323593c5 100644
--- a/ext/opencv/gstfacedetect.cpp
+++ b/ext/opencv/gstfacedetect.cpp
@@ -88,7 +88,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_face_detect_debug);
#define GST_CAT_DEFAULT gst_face_detect_debug
#define HAAR_CASCADES_DIR OPENCV_PREFIX G_DIR_SEPARATOR_S "share" \
- G_DIR_SEPARATOR_S "opencv" G_DIR_SEPARATOR_S "haarcascades" \
+ G_DIR_SEPARATOR_S OPENCV_PATH_NAME G_DIR_SEPARATOR_S "haarcascades" \
G_DIR_SEPARATOR_S
#define DEFAULT_FACE_PROFILE HAAR_CASCADES_DIR "haarcascade_frontalface_default.xml"
#define DEFAULT_NOSE_PROFILE HAAR_CASCADES_DIR "haarcascade_mcs_nose.xml"