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
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"
+ else
+ HAVE_OPENCV="yes"
+ fi
+ ], [
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)
#include <errno.h>
#include "MotionCells.h"
#include <opencv2/imgproc.hpp>
+#if (CV_MAJOR_VERSION >= 4)
+#include <opencv2/imgproc/imgproc_c.h>
+#endif
MotionCells::MotionCells ()
{
#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>
#define __GST_CAMERA_UTILS_H__
#include <gst/gst.h>
-#include <cv.h>
+#include <opencv2/core.hpp>
G_BEGIN_DECLS
#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>
#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>
#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
#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
#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
#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
#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);
#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
#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 */
#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
#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 */
#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
#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
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
#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
#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
#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
#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
/* element header */
#include "gsthanddetect.h"
#include <opencv2/imgproc.hpp>
+#if (CV_MAJOR_VERSION >= 4)
+#include <opencv2/imgproc/imgproc_c.h>
+#endif
GST_DEBUG_CATEGORY_STATIC (gst_handdetect_debug);
#define GST_CAT_DEFAULT gst_handdetect_debug
Mat roi (image, Rect (filter->cvGray->origin,
filter->cvGray->origin, filter->cvGray->width,
filter->cvGray->height));
+#if (CV_MAJOR_VERSION >= 4)
+ filter->cvCascade_fist->detectMultiScale (roi, hands, 1.1, 2,
+ CASCADE_DO_CANNY_PRUNING, cvSize (24, 24), cvSize (0, 0));
+#else
filter->cvCascade_fist->detectMultiScale (roi, hands, 1.1, 2,
CV_HAAR_DO_CANNY_PRUNING, cvSize (24, 24), cvSize (0, 0));
+#endif
/* if FIST gesture detected */
if (!hands.empty ()) {
}
} else {
/* if NO FIST gesture, detecting PALM gesture */
+#if (CV_MAJOR_VERSION >= 4)
+ filter->cvCascade_palm->detectMultiScale (roi, hands, 1.1, 2,
+ CASCADE_DO_CANNY_PRUNING, cvSize (24, 24), cvSize (0, 0));
+#else
filter->cvCascade_palm->detectMultiScale (roi, hands, 1.1, 2,
CV_HAAR_DO_CANNY_PRUNING, cvSize (24, 24), cvSize (0, 0));
+#endif
/* if PALM detected */
if (!hands.empty ()) {
int min_distance, distance;
#ifndef __GST_HANDDETECT_H__
#define __GST_HANDDETECT_H__
-#include <cv.h>
-
#include <gst/opencv/gstopencvvideofilter.h>
/* opencv */
#include <opencv2/core.hpp>
#include "gstretinex.h"
#include <opencv2/imgproc.hpp>
+#if (CV_MAJOR_VERSION >= 4)
+#include <opencv2/imgproc/imgproc_c.h>
+#endif
GST_DEBUG_CATEGORY_STATIC (gst_retinex_debug);
#define GST_CAT_DEFAULT gst_retinex_debug
#include "gstsegmentation.h"
#include <opencv2/imgproc.hpp>
+#if (CV_MAJOR_VERSION >= 4)
+#include <opencv2/imgproc/imgproc_c.h>
+#endif
GST_DEBUG_CATEGORY_STATIC (gst_segmentation_debug);
#define GST_CAT_DEFAULT gst_segmentation_debug
#include <opencv2/video.hpp>
#include <opencv2/core.hpp>
#include <opencv2/bgsegm.hpp>
-
+#if (CV_MAJOR_VERSION >= 4)
+#include <opencv2/core/types_c.h>
+#endif
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
#include "gstskindetect.h"
#include <opencv2/imgproc.hpp>
+#if (CV_MAJOR_VERSION >= 4)
+#include <opencv2/imgproc/imgproc_c.h>
+#endif
GST_DEBUG_CATEGORY_STATIC (gst_skin_detect_debug);
#define GST_CAT_DEFAULT gst_skin_detect_debug
#include "../../gst-libs/gst/gst-i18n-plugin.h"
#include "gsttemplatematch.h"
#include <opencv2/imgproc.hpp>
+#if (CV_MAJOR_VERSION >= 4)
+#include <opencv2/imgproc/imgproc_c.h>
+#include <opencv2/imgcodecs.hpp>
+#include <opencv2/imgcodecs/legacy/constants_c.h>
+#else
#include <opencv2/imgcodecs/imgcodecs_c.h>
+#endif
GST_DEBUG_CATEGORY_STATIC (gst_template_match_debug);
#define GST_CAT_DEFAULT gst_template_match_debug
NULL;
if (templ) {
+#if (CV_MAJOR_VERSION >= 4)
+ cv::Mat mat = cv::imread (templ);
+ newTemplateImage =
+ cvCreateImage (cvSize (mat.cols, mat.rows), cvIplDepth (mat.flags),
+ mat.channels ());
+ IplImage ipltemp = mat;
+ cvCopy (&ipltemp, newTemplateImage);
+#else
newTemplateImage = cvLoadImage (templ, CV_LOAD_IMAGE_COLOR);
+#endif
if (!newTemplateImage) {
/* Unfortunately OpenCV doesn't seem to provide any way of finding out
why the image load failed, so we can't be more specific than FAILED: */
#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
'opencv2/video.hpp',
]
+libopencv4_headers = [
+ 'opencv4/opencv2/bgsegm.hpp',
+ 'opencv4/opencv2/calib3d.hpp',
+ 'opencv4/opencv2/core.hpp',
+ 'opencv4/opencv2/imgcodecs/legacy/constants_c.h',
+ 'opencv4/opencv2/imgproc/imgproc_c.h',
+ 'opencv4/opencv2/core/types_c.h',
+ 'opencv4/opencv2/core/core_c.h',
+ 'opencv4/opencv2/imgproc.hpp',
+ 'opencv4/opencv2/objdetect.hpp',
+ 'opencv4/opencv2/opencv.hpp',
+ 'opencv4/opencv2/video.hpp',
+]
+
gstopencv_cargs = ['-DGST_HAAR_CASCADES_DIR="@0@"']
opencv_dep = dependency('opencv', version : ['>= 3.0.0', '< 3.5.0'], required : false)
opencv_found = false
endif
endforeach
+else
+ opencv_dep = dependency('opencv4', version : ['>= 4.0.0', '< 4.1.0'], required : false)
+ opencv_found = opencv_dep.found()
+ if opencv_found
+ foreach h : libopencv4_headers
+ if not cxx.has_header(h)
+ message('Needed header "' + h + '" not found')
+ opencv_found = false
+ endif
+ endforeach
+ endif
endif
if opencv_found
if r.returncode() == 0
gstopencv_cargs += '-DOPENCV_PATH_NAME="OpenCV"'
else
- error('Unable to detect OpenCV data directory')
+ r = run_command('test', '-d', opencv_prefix + '/share/opencv4')
+ if r.returncode() == 0
+ gstopencv_cargs += '-DOPENCV_PATH_NAME="opencv4"'
+ else
+ error('Unable to detect OpenCV data directory')
+ endif
endif
endif
gstopencv = library('gstopencv',
#include "gstopencvutils.h"
#include <opencv2/core.hpp>
+#if (CV_MAJOR_VERSION >= 4)
+#include <opencv2/core/types_c.h>
+#endif
/*
The various opencv image containers or headers store the following information:
#include "gstopencvutils.h"
#include <opencv2/core.hpp>
+#if (CV_MAJOR_VERSION >= 4)
+#include <opencv2/core/core_c.h>
+#endif
GST_DEBUG_CATEGORY_STATIC (gst_opencv_video_filter_debug);
#define GST_CAT_DEFAULT gst_opencv_video_filter_debug
]
opencv_dep = dependency('opencv', version : '>= 3.0.0', required : get_option('opencv'))
+if not opencv_dep.found()
+ opencv_dep = dependency('opencv4', version : '>= 4.0.0', required : get_option('opencv'))
+endif
if opencv_dep.found()
gstopencv = library('gstopencv-' + api_version,
opencv_sources,