mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
opencv: Bump requirement to 3.0.0+
And removes all the ifdef code to support the 2.X APIs.
This commit is contained in:
parent
f028f817e3
commit
cabf875098
14 changed files with 29 additions and 142 deletions
11
configure.ac
11
configure.ac
|
@ -1885,7 +1885,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 >= 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
|
||||
|
@ -1897,13 +1897,8 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [
|
|||
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])
|
||||
|
|
|
@ -42,19 +42,13 @@
|
|||
* 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 ()
|
||||
{
|
||||
|
|
|
@ -84,9 +84,7 @@
|
|||
|
||||
#include "gstcameracalibrate.h"
|
||||
|
||||
#if (CV_MAJOR_VERSION >= 3)
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#endif
|
||||
#include <opencv2/calib3d.hpp>
|
||||
|
||||
#include <gst/opencv/gstopencvutils.h>
|
||||
|
|
|
@ -77,9 +77,7 @@
|
|||
|
||||
#include "gstcameraundistort.h"
|
||||
|
||||
#if (CV_MAJOR_VERSION >= 3)
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#endif
|
||||
#include <opencv2/calib3d.hpp>
|
||||
|
||||
#include <gst/opencv/gstopencvutils.h>
|
||||
|
|
|
@ -120,10 +120,7 @@ gst-launch-1.0 multifilesrc location=~/im3.png ! pngdec ! videoconvert ! di
|
|||
#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
|
||||
|
@ -646,7 +643,7 @@ initialise_sbm (GstDisparity * filter)
|
|||
(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);
|
||||
|
||||
|
@ -672,33 +669,6 @@ initialise_sbm (GstDisparity * filter)
|
|||
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);
|
||||
}
|
||||
|
@ -706,34 +676,22 @@ initialise_sbm (GstDisparity * filter)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -743,12 +701,9 @@ finalise_sbm (GstDisparity * filter)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -47,9 +47,8 @@
|
|||
#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 */
|
||||
|
@ -97,13 +96,9 @@ struct _GstDisparity
|
|||
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
|
||||
|
|
|
@ -81,9 +81,7 @@
|
|||
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
|
||||
|
|
|
@ -62,10 +62,7 @@
|
|||
|
||||
/* 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
|
||||
|
|
|
@ -97,9 +97,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_segmentation_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
|
||||
{
|
||||
|
@ -776,13 +775,8 @@ initialise_mog (GstSegmentation * filter)
|
|||
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);
|
||||
}
|
||||
|
@ -805,15 +799,9 @@ run_mog_iteration (GstSegmentation * filter)
|
|||
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);
|
||||
}
|
||||
|
@ -839,15 +827,9 @@ run_mog2_iteration (GstSegmentation * filter)
|
|||
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);
|
||||
}
|
||||
|
@ -857,12 +839,9 @@ finalise_mog (GstSegmentation * filter)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -46,12 +46,10 @@
|
|||
|
||||
#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
|
||||
|
@ -110,13 +108,9 @@ struct _GstSegmentation
|
|||
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;
|
||||
|
|
|
@ -63,10 +63,7 @@
|
|||
|
||||
#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
|
||||
|
|
|
@ -47,10 +47,9 @@
|
|||
#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 */
|
||||
|
|
|
@ -28,7 +28,7 @@ gstopencv_sources = [
|
|||
'gstcameraundistort.cpp'
|
||||
]
|
||||
|
||||
libopencv2_headers = [
|
||||
libopencv_headers = [
|
||||
'opencv2/core/core_c.h',
|
||||
'opencv2/core/version.hpp',
|
||||
'opencv2/highgui/highgui_c.h',
|
||||
|
@ -36,33 +36,21 @@ libopencv2_headers = [
|
|||
'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
|
||||
|
|
|
@ -9,7 +9,7 @@ opencv_headers = [
|
|||
'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,
|
||||
|
|
Loading…
Reference in a new issue