From bf03940bcb38e8caf833e7f01a973c51c9eea3eb Mon Sep 17 00:00:00 2001 From: David Rose Date: Sun, 8 Jul 2012 20:04:33 +0000 Subject: [PATCH] opencv 2.3 --- dtool/Config.pp | 9 ++++++--- dtool/LocalSetup.pp | 1 + dtool/src/parser-inc/Sources.pp | 3 ++- dtool/src/parser-inc/core.hpp | 8 ++++++++ dtool/src/parser-inc/highgui.hpp | 0 panda/src/vision/openCVTexture.h | 14 +++++++++++++- 6 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 dtool/src/parser-inc/core.hpp create mode 100644 dtool/src/parser-inc/highgui.hpp diff --git a/dtool/Config.pp b/dtool/Config.pp index ce682bb30a..52445e05cd 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -774,10 +774,13 @@ // the default for 64-bit windows. #defer USE_GENERIC_DXERR_LIBRARY $[WIN64_PLATFORM] +// Do we have at least OpenCV 2.3? +#define OPENCV_VER_23 1 + // Is OpenCV installed, and where? -#define OPENCV_IPATH /usr/local/include/opencv -#define OPENCV_LPATH /usr/local/lib -#define OPENCV_LIBS $[if $[WINDOWS_PLATFORM],cv.lib highgui.lib cxcore.lib,cv highgui cxcore] +#define OPENCV_IPATH +#define OPENCV_LPATH +#defer OPENCV_LIBS $[if $[OPENCV_VER_23], opencv_highgui opencv_core, cv highgui cxcore] #defer HAVE_OPENCV $[libtest $[OPENCV_LPATH],$[OPENCV_LIBS]] // Is FFMPEG installed, and where? diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp index df2b4cafbf..128ed97801 100644 --- a/dtool/LocalSetup.pp +++ b/dtool/LocalSetup.pp @@ -410,6 +410,7 @@ $[cdefine HAVE_GLES2] /* Define if we have OpenCV installed and want to build for OpenCV. */ $[cdefine HAVE_OPENCV] +$[cdefine OPENCV_VER_23] /* Define if we have FFMPEG installed and want to build for FFMPEG. */ $[cdefine HAVE_FFMPEG] diff --git a/dtool/src/parser-inc/Sources.pp b/dtool/src/parser-inc/Sources.pp index d391fb3ca5..ffb3ee0eaa 100644 --- a/dtool/src/parser-inc/Sources.pp +++ b/dtool/src/parser-inc/Sources.pp @@ -9,7 +9,8 @@ nurbs.hh stddef.h krb5.h MainHelix.h dllpath.h hxcom.h \ hxcomm.h hxcore.h hxengin.h hxerror.h hxfiles.h hxtbuf.h \ hxtbuff.h hxwin.h pyconfig.h Python.h py_panda.h Cg/cg.h Cg/cgGL.h \ - cv.h cvtypes.h cxcore.h cxerror.h cxtypes.h highgui.h \ + opencv/cv.h opencv/cxcore.h opencv/highgui.h \ + opencv2/core/core.hpp opencv2/highgui/highgui.hpp \ avcodec.h avformat.h avio.h avutil.h swscale.h integer.h \ intfloat_readwrite.h mathematics.h rational.h rtp.h \ rtsp.h rtspcodes.h setjmp.h tinyxml.h winsock2.h \ diff --git a/dtool/src/parser-inc/core.hpp b/dtool/src/parser-inc/core.hpp new file mode 100644 index 0000000000..1a7a20de7c --- /dev/null +++ b/dtool/src/parser-inc/core.hpp @@ -0,0 +1,8 @@ +#ifndef _CV_H_ +#define _CV_H_ + +typedef struct CvCapture CvCapture; + +typedef struct CvMemStorage CvMemStorage; +typedef struct CvHaarClassifierCascade CvHaarClassifierCascade; +#endif diff --git a/dtool/src/parser-inc/highgui.hpp b/dtool/src/parser-inc/highgui.hpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/panda/src/vision/openCVTexture.h b/panda/src/vision/openCVTexture.h index 55acc3ec60..9f67858c51 100644 --- a/panda/src/vision/openCVTexture.h +++ b/panda/src/vision/openCVTexture.h @@ -20,10 +20,22 @@ #include "videoTexture.h" -#include +// This symbol is predefined by the Panda3D build system to select +// whether we are using the OpenCV 2.3 or later interface, or if it is +// not defined, we are using the original interface. +#ifdef OPENCV_VER_23 + +#include +//#include +#include + +#else #include +#include #include +#endif // OPENCV_VER_23 + //////////////////////////////////////////////////////////////////// // Class : OpenCVTexture // Description : A specialization on VideoTexture that takes its input