Commit b0773c6e authored by Nicola Murino's avatar Nicola Murino Committed by Nicolas Dufresne
Browse files

opencv: make compatible with opencv 4

Closed #826
parent 890dbb56
......@@ -1846,7 +1846,7 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [
dnl a new version and the no-backward-compatibility define. (There doesn't
dnl seem to be a switch to suppress the warnings the cvcompat.h header
dnl causes.)
PKG_CHECK_MODULES(OPENCV, opencv >= 3.0.0 opencv < 3.5.0 , [
PKG_CHECK_MODULES([OPENCV], [opencv >= 3.0.0 opencv < 3.5.0] , [
AC_PROG_CXX
AC_LANG([C++])
OLD_CPPFLAGS=$CPPFLAGS
......@@ -1865,6 +1865,35 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [
CPPFLAGS=$OLD_CPPFLAGS
AC_LANG([C])
if test $something_not_found = "yes"; then
AC_MSG_RESULT([not all opencv2 headers were found])
HAVE_OPENCV="no"
else
HAVE_OPENCV="yes"
fi
], [
PKG_CHECK_MODULES([OPENCV], [opencv4 >= 4.0.0 opencv4 < 4.1.0] , [
AC_PROG_CXX
AC_LANG([C++])
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS=$OPENCV_CFLAGS
something_not_found=no
AC_CHECK_HEADERS([opencv2/bgsegm.hpp \
opencv2/calib3d.hpp \
opencv2/core.hpp \
opencv2/imgcodecs/legacy/constants_c.h \
opencv2/imgproc/imgproc_c.h \
opencv2/core/types_c.h \
opencv2/core/core_c.h \
opencv2/imgproc.hpp \
opencv2/objdetect.hpp \
opencv2/opencv.hpp \
opencv2/video.hpp \
opencv2/bgsegm.hpp], [], [something_not_found=yes])
CPPFLAGS=$OLD_CPPFLAGS
AC_LANG([C])
if test $something_not_found = "yes"; then
AC_MSG_RESULT([not all opencv2 headers were found])
HAVE_OPENCV="no"
......@@ -1874,6 +1903,10 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [
], [
HAVE_OPENCV="no"
])
])
OPENCV_PREFIX="`$PKG_CONFIG --variable=prefix opencv`"
AC_DEFINE_UNQUOTED(OPENCV_PREFIX, "$OPENCV_PREFIX", [opencv install prefix])
AC_SUBST(OPENCV_PREFIX)
OPENCV_PREFIX="`$PKG_CONFIG --variable=prefix opencv`"
AC_DEFINE_UNQUOTED(OPENCV_PREFIX, "$OPENCV_PREFIX", [opencv install prefix])
AC_SUBST(OPENCV_PREFIX)
......
......@@ -49,6 +49,9 @@
#include <errno.h>
#include "MotionCells.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
MotionCells::MotionCells ()
{
......
......@@ -46,6 +46,10 @@
#define MOTIONCELLS_H_
#include <opencv2/core.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/core/types_c.h>
#include <opencv2/core/core_c.h>
#endif
#include <fstream>
#include <vector>
......
......@@ -21,7 +21,7 @@
#define __GST_CAMERA_UTILS_H__
#include <gst/gst.h>
#include <cv.h>
#include <opencv2/core.hpp>
G_BEGIN_DECLS
......
......@@ -85,6 +85,9 @@
#include "gstcameracalibrate.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
#include <opencv2/calib3d.hpp>
#include <gst/opencv/gstopencvutils.h>
......
......@@ -78,6 +78,9 @@
#include "gstcameraundistort.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
#include <opencv2/calib3d.hpp>
#include <gst/opencv/gstopencvutils.h>
......
......@@ -60,6 +60,9 @@
#include "gstcvdilate.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_cv_dilate_debug);
#define GST_CAT_DEFAULT gst_cv_dilate_debug
......
......@@ -62,6 +62,9 @@
#include "gstcvequalizehist.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_cv_equalize_hist_debug);
#define GST_CAT_DEFAULT gst_cv_equalize_hist_debug
......
......@@ -60,6 +60,9 @@
#include "gstcverode.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_cv_erode_debug);
#define GST_CAT_DEFAULT gst_cv_erode_debug
......
......@@ -60,6 +60,11 @@
#include "gstcvlaplace.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/core/core_c.h>
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_cv_laplace_debug);
#define GST_CAT_DEFAULT gst_cv_laplace_debug
......
......@@ -61,6 +61,9 @@
#include "gst/opencv/gstopencvutils.h"
#include "gstcvsmooth.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_cv_smooth_debug);
......
......@@ -60,6 +60,9 @@
#include "gstcvsobel.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_cv_sobel_debug);
#define GST_CAT_DEFAULT gst_cv_sobel_debug
......
......@@ -49,6 +49,9 @@
#include <gst/opencv/gstopencvvideofilter.h>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
......
......@@ -121,6 +121,9 @@ gst-launch-1.0 multifilesrc location=~/im3.png ! pngdec ! videoconvert ! di
#include "gstdisparity.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_disparity_debug);
#define GST_CAT_DEFAULT gst_disparity_debug
......
......@@ -49,6 +49,9 @@
#include <opencv2/core.hpp>
#include <opencv2/calib3d.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/core/types_c.h>
#endif
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
......
......@@ -62,6 +62,9 @@
#include "gstedgedetect.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_edge_detect_debug);
#define GST_CAT_DEFAULT gst_edge_detect_debug
......
......@@ -65,6 +65,9 @@
#include "gstfaceblur.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_face_blur_debug);
#define GST_CAT_DEFAULT gst_face_blur_debug
......@@ -73,7 +76,11 @@ GST_DEBUG_CATEGORY_STATIC (gst_face_blur_debug);
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
#if (CV_MAJOR_VERSION >= 4)
#define DEFAULT_FLAGS CASCADE_DO_CANNY_PRUNING
#else
#define DEFAULT_FLAGS CV_HAAR_DO_CANNY_PRUNING
#endif
#define DEFAULT_MIN_NEIGHBORS 3
#define DEFAULT_MIN_SIZE_WIDTH 30
#define DEFAULT_MIN_SIZE_HEIGHT 30
......
......@@ -82,6 +82,9 @@ using namespace std;
#include "gstfacedetect.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_face_detect_debug);
#define GST_CAT_DEFAULT gst_face_detect_debug
......@@ -94,7 +97,11 @@ GST_DEBUG_CATEGORY_STATIC (gst_face_detect_debug);
#define DEFAULT_MOUTH_PROFILE HAAR_CASCADES_DIR "haarcascade_mcs_mouth.xml"
#define DEFAULT_EYES_PROFILE HAAR_CASCADES_DIR "haarcascade_mcs_eyepair_small.xml"
#define DEFAULT_SCALE_FACTOR 1.25
#if (CV_MAJOR_VERSION >= 4)
#define DEFAULT_FLAGS CASCADE_DO_CANNY_PRUNING
#else
#define DEFAULT_FLAGS CV_HAAR_DO_CANNY_PRUNING
#endif
#define DEFAULT_MIN_NEIGHBORS 3
#define DEFAULT_MIN_SIZE_WIDTH 30
#define DEFAULT_MIN_SIZE_HEIGHT 30
......
......@@ -86,6 +86,9 @@
#include "gstgrabcut.h"
#include <opencv2/imgproc.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/imgproc/imgproc_c.h>
#endif
GST_DEBUG_CATEGORY_STATIC (gst_grabcut_debug);
#define GST_CAT_DEFAULT gst_grabcut_debug
......
......@@ -49,7 +49,9 @@
#include <gst/video/gstvideofilter.h>
#include <gst/opencv/gstopencvvideofilter.h>
#include <opencv2/core.hpp>
#if (CV_MAJOR_VERSION >= 4)
#include <opencv2/core/types_c.h>
#endif
G_BEGIN_DECLS
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment