And removes all the ifdef code to support the 2.X APIs.
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 >= 2.3.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
opencv2/imgproc/imgproc.hpp \
opencv2/imgproc/imgproc_c.h \
opencv2/objdetect/objdetect.hpp \
- opencv2/video/background_segm.hpp], [], [something_not_found=yes])
-
- dnl Only required for OpenCV >= 3, we have compat code for older versions
- PKG_CHECK_MODULES(OPENCV_3, opencv >= 3, [
- dnl check opencv_contrib headers (not always present in opencv distributions)
- AC_CHECK_HEADERS([opencv2/bgsegm.hpp], [], [something_not_found=yes])],
- [NOT_A_PROBLEM=yes])
+ opencv2/video/background_segm.hpp \
+ opencv2/bgsegm.hpp], [], [something_not_found=yes])
CPPFLAGS=$OLD_CPPFLAGS
AC_LANG([C])
* Boston, MA 02110-1301, USA.
*/
-/* This breaks the build for reasons that aren't entirely clear to me yet */
-#if 0
-//#ifdef HAVE_CONFIG_H
-//#include "config.h"
-//#endif
+#ifdef HAVE_CONFIG_H
+#include "config.h"
#endif
#include <errno.h>
#include "MotionCells.h"
-#if (CV_MAJOR_VERSION >= 3)
#include <opencv2/imgproc.hpp>
-#endif
-#include <opencv2/imgproc/imgproc_c.h>
MotionCells::MotionCells ()
{
#include "gstcameracalibrate.h"
-#if (CV_MAJOR_VERSION >= 3)
#include <opencv2/imgproc.hpp>
-#endif
#include <opencv2/calib3d.hpp>
#include <gst/opencv/gstopencvutils.h>
#include "gstcameraundistort.h"
-#if (CV_MAJOR_VERSION >= 3)
#include <opencv2/imgproc.hpp>
-#endif
#include <opencv2/calib3d.hpp>
#include <gst/opencv/gstopencvutils.h>
#endif
#include "gstdisparity.h"
-#include <opencv2/imgproc/imgproc_c.h>
-#if (CV_MAJOR_VERSION >= 3)
#include <opencv2/imgproc.hpp>
-#endif
GST_DEBUG_CATEGORY_STATIC (gst_disparity_debug);
#define GST_CAT_DEFAULT gst_disparity_debug
(void *) new Mat (cvarrToMat (filter->cvGray_left, false));
filter->depth_map_as_cvMat =
(void *) new Mat (cvarrToMat (filter->cvGray_depth_map1, false));
-#if (CV_MAJOR_VERSION >= 3)
+
filter->sbm = StereoBM::create();
filter->sgbm = StereoSGBM::create(1,64,3);
filter->sgbm->setSpeckleWindowSize (0);
filter->sgbm->setSpeckleRange (0);
filter->sgbm->setMode (StereoSGBM::MODE_HH);
-#else
- filter->sbm = (void *) new StereoBM ();
- filter->sgbm = (void *) new StereoSGBM ();
-
- ((StereoBM *) filter->sbm)->state->SADWindowSize = 9;
- ((StereoBM *) filter->sbm)->state->numberOfDisparities = 32;
- ((StereoBM *) filter->sbm)->state->preFilterSize = 9;
- ((StereoBM *) filter->sbm)->state->preFilterCap = 32;
- ((StereoBM *) filter->sbm)->state->minDisparity = 0;
- ((StereoBM *) filter->sbm)->state->textureThreshold = 0;
- ((StereoBM *) filter->sbm)->state->uniquenessRatio = 0;
- ((StereoBM *) filter->sbm)->state->speckleWindowSize = 0;
- ((StereoBM *) filter->sbm)->state->speckleRange = 0;
- ((StereoBM *) filter->sbm)->state->disp12MaxDiff = 0;
-
- ((StereoSGBM *) filter->sgbm)->minDisparity = 1;
- ((StereoSGBM *) filter->sgbm)->numberOfDisparities = 64;
- ((StereoSGBM *) filter->sgbm)->SADWindowSize = 3;
- ((StereoSGBM *) filter->sgbm)->P1 = 200;;
- ((StereoSGBM *) filter->sgbm)->P2 = 255;
- ((StereoSGBM *) filter->sgbm)->disp12MaxDiff = 0;
- ((StereoSGBM *) filter->sgbm)->preFilterCap = 0;
- ((StereoSGBM *) filter->sgbm)->uniquenessRatio = 0;
- ((StereoSGBM *) filter->sgbm)->speckleWindowSize = 0;
- ((StereoSGBM *) filter->sgbm)->speckleRange = 0;
- ((StereoSGBM *) filter->sgbm)->fullDP = true;
-#endif
return (0);
}
int
run_sbm_iteration (GstDisparity * filter)
{
-#if (CV_MAJOR_VERSION >= 3)
((StereoBM *) filter->
sbm)->compute (*((Mat *) filter->img_left_as_cvMat_gray),
*((Mat *) filter->img_right_as_cvMat_gray),
*((Mat *) filter->depth_map_as_cvMat));
-#else
- (*((StereoBM *) filter->
- sbm)) (*((Mat *) filter->img_left_as_cvMat_gray),
- *((Mat *) filter->img_right_as_cvMat_gray),
- *((Mat *) filter->depth_map_as_cvMat));
-#endif
+
return (0);
}
int
run_sgbm_iteration (GstDisparity * filter)
{
-#if (CV_MAJOR_VERSION >= 3)
((StereoSGBM *) filter->
sgbm)->compute (*((Mat *) filter->img_left_as_cvMat_gray),
*((Mat *) filter->img_right_as_cvMat_gray),
*((Mat *) filter->depth_map_as_cvMat));
-#else
- (*((StereoSGBM *) filter->
- sgbm)) (*((Mat *) filter->img_left_as_cvMat_gray),
- *((Mat *) filter->img_right_as_cvMat_gray),
- *((Mat *) filter->depth_map_as_cvMat));
-#endif
+
return (0);
}
delete (Mat *) filter->depth_map_as_cvMat;
delete (Mat *) filter->img_left_as_cvMat_gray;
delete (Mat *) filter->img_right_as_cvMat_gray;
-#if (CV_MAJOR_VERSION >= 3)
+
filter->sbm.release();
filter->sgbm.release();
-#else
- delete (StereoBM *) filter->sbm;
- delete (StereoSGBM *) filter->sgbm;
-#endif
+
return (0);
}
#include <gst/gst.h>
#include <gst/video/video.h>
-#include <opencv2/core/core.hpp>
-#include <opencv2/calib3d/calib3d.hpp>
-#include <opencv2/core/version.hpp>
+#include <opencv2/core.hpp>
+#include <opencv2/calib3d.hpp>
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
void *img_right_as_cvMat_gray; /* cv::Mat */
void *img_left_as_cvMat_gray; /* cv::Mat */
void *depth_map_as_cvMat; /* cv::Mat */
-#if (CV_MAJOR_VERSION >= 3)
+
cv::Ptr<cv::StereoBM> sbm; /* cv::StereoBM */
cv::Ptr<cv::StereoSGBM> sgbm; /* cv::StereoSGBM */
-#else
- void *sbm; /* cv::StereoBM */
- void *sgbm; /* cv::StereoSGBM */
-#endif
};
struct _GstDisparityClass
using namespace std;
#include "gstfacedetect.h"
-#if (CV_MAJOR_VERSION >= 3)
#include <opencv2/imgproc.hpp>
-#endif
GST_DEBUG_CATEGORY_STATIC (gst_face_detect_debug);
#define GST_CAT_DEFAULT gst_face_detect_debug
/* element header */
#include "gsthanddetect.h"
-#if (CV_MAJOR_VERSION >= 3)
#include <opencv2/imgproc.hpp>
-#endif
-#include <opencv2/imgproc/imgproc_c.h>
GST_DEBUG_CATEGORY_STATIC (gst_handdetect_debug);
#define GST_CAT_DEFAULT gst_handdetect_debug
#define GST_CAT_DEFAULT gst_segmentation_debug
using namespace cv;
-#if (CV_MAJOR_VERSION >= 3)
- using namespace cv::bgsegm;
-#endif
+using namespace cv::bgsegm;
+
/* Filter signals and args */
enum
{
filter->img_input_as_cvMat = (void *) new Mat (cvarrToMat (filter->cvYUV, false));
filter->img_fg_as_cvMat = (void *) new Mat (cvarrToMat(filter->cvFG, false));
-#if (CV_MAJOR_VERSION >= 3)
filter->mog = bgsegm::createBackgroundSubtractorMOG ();
filter->mog2 = createBackgroundSubtractorMOG2 ();
-#else
- filter->mog = (void *) new BackgroundSubtractorMOG ();
- filter->mog2 = (void *) new BackgroundSubtractorMOG2 ();
-#endif
return (0);
}
European Workshop on Advanced Video-Based Surveillance Systems, 2001
*/
-#if (CV_MAJOR_VERSION >= 3)
filter->mog->apply (*((Mat *) filter->
img_input_as_cvMat), *((Mat *) filter->img_fg_as_cvMat),
filter->learning_rate);
-#else
- (*((BackgroundSubtractorMOG *) filter->mog)) (*((Mat *) filter->
- img_input_as_cvMat), *((Mat *) filter->img_fg_as_cvMat),
- filter->learning_rate);
-#endif
return (0);
}
Letters, vol. 27, no. 7, pages 773-780, 2006.
*/
-#if (CV_MAJOR_VERSION >= 3)
filter->mog2->apply (*((Mat *) filter->
img_input_as_cvMat), *((Mat *) filter->img_fg_as_cvMat),
filter->learning_rate);
-#else
- (*((BackgroundSubtractorMOG *) filter->mog2)) (*((Mat *) filter->
- img_input_as_cvMat), *((Mat *) filter->img_fg_as_cvMat),
- filter->learning_rate);
-#endif
return (0);
}
{
delete (Mat *) filter->img_input_as_cvMat;
delete (Mat *) filter->img_fg_as_cvMat;
-#if (CV_MAJOR_VERSION >= 3)
+
filter->mog.release ();
filter->mog2.release ();
-#else
- delete (BackgroundSubtractorMOG *) filter->mog;
- delete (BackgroundSubtractorMOG2 *) filter->mog2;
-#endif
+
return (0);
}
#include <gst/gst.h>
#include <gst/opencv/gstopencvvideofilter.h>
-#include <opencv2/core/core_c.h>
-#include <opencv2/video/background_segm.hpp>
-#include <opencv2/core/version.hpp>
-#if (CV_MAJOR_VERSION >= 3)
- #include <opencv2/bgsegm.hpp>
-#endif
+
+#include <opencv2/video.hpp>
+#include <opencv2/core.hpp>
+#include <opencv2/bgsegm.hpp>
G_BEGIN_DECLS
CvSeq *contours;
/* for MOG methods */
-#if (CV_MAJOR_VERSION >= 3)
cv::Ptr<cv::BackgroundSubtractor> mog; /* cv::BackgroundSubtractorMOG */
cv::Ptr<cv::BackgroundSubtractorMOG2> mog2; /* cv::BackgroundSubtractorMOG2 */
-#else
- void *mog; /* cv::BackgroundSubtractorMOG */
- void *mog2; /* cv::BackgroundSubtractorMOG2 */
-#endif
+
void *img_input_as_cvMat; /* cv::Mat */
void *img_fg_as_cvMat; /* cv::Mat */
double learning_rate;
#include "../../gst-libs/gst/gst-i18n-plugin.h"
#include "gsttemplatematch.h"
-#if (CV_MAJOR_VERSION >= 3)
#include <opencv2/imgproc.hpp>
-#endif
-#include <opencv2/imgproc/imgproc_c.h>
GST_DEBUG_CATEGORY_STATIC (gst_template_match_debug);
#define GST_CAT_DEFAULT gst_template_match_debug
#define __GST_OPENCV_TEXT_OVERLAY_H__
#include <gst/opencv/gstopencvvideofilter.h>
-#include <opencv2/core/core_c.h>
-#if (CV_MAJOR_VERSION >= 3)
-#include <opencv2/imgproc/imgproc_c.h>
-#endif
+#include <opencv2/core.hpp>
+#include <opencv2/imgproc.hpp>
+
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
'gstcameraundistort.cpp'
]
-libopencv2_headers = [
+libopencv_headers = [
'opencv2/core/core_c.h',
'opencv2/core/version.hpp',
'opencv2/highgui/highgui_c.h',
'opencv2/imgproc/imgproc_c.h',
'opencv2/objdetect/objdetect.hpp',
'opencv2/video/background_segm.hpp',
-]
-
-libopencv3_headers = [
'opencv2/bgsegm.hpp',
]
gstopencv_cargs = ['-DGST_HAAR_CASCADES_DIR="@0@"']
-opencv_dep = dependency('opencv', version : ['>= 2.3.0', '< 3.5.0'], required : false)
+opencv_dep = dependency('opencv', version : ['>= 3.0.0', '< 3.5.0'], required : false)
opencv_found = opencv_dep.found()
if opencv_found
- foreach h : libopencv2_headers
+ foreach h : libopencv_headers
if not cxx.has_header(h)
message('Needed header "' + h + '" not found')
opencv_found = false
endif
endforeach
-
- if opencv_dep.version() >= '3.0.0'
- foreach h : libopencv3_headers
- if not cxx.has_header(h)
- message('Needed header "' + h + '" not found')
- opencv_found = false
- endif
- endforeach
- endif
endif
if opencv_found
'gstopencvvideofilter.h',
]
-opencv_dep = dependency('opencv', version : '>= 2.3.0', required : get_option('opencv'))
+opencv_dep = dependency('opencv', version : '>= 3.0.0', required : get_option('opencv'))
if opencv_dep.found()
gstopencv = library('gstopencv-' + api_version,
opencv_sources,