Browse Source

opencv 2.3

David Rose 13 years ago
parent
commit
bf03940bcb

+ 6 - 3
dtool/Config.pp

@@ -774,10 +774,13 @@
 // the default for 64-bit windows.
 // the default for 64-bit windows.
 #defer USE_GENERIC_DXERR_LIBRARY $[WIN64_PLATFORM]
 #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?
 // 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]]
 #defer HAVE_OPENCV $[libtest $[OPENCV_LPATH],$[OPENCV_LIBS]]
 
 
 // Is FFMPEG installed, and where?
 // Is FFMPEG installed, and where?

+ 1 - 0
dtool/LocalSetup.pp

@@ -410,6 +410,7 @@ $[cdefine HAVE_GLES2]
 
 
 /* Define if we have OpenCV installed and want to build for OpenCV.  */
 /* Define if we have OpenCV installed and want to build for OpenCV.  */
 $[cdefine HAVE_OPENCV]
 $[cdefine HAVE_OPENCV]
+$[cdefine OPENCV_VER_23]
 
 
 /* Define if we have FFMPEG installed and want to build for FFMPEG.  */
 /* Define if we have FFMPEG installed and want to build for FFMPEG.  */
 $[cdefine HAVE_FFMPEG]
 $[cdefine HAVE_FFMPEG]

+ 2 - 1
dtool/src/parser-inc/Sources.pp

@@ -9,7 +9,8 @@
     nurbs.hh stddef.h krb5.h MainHelix.h dllpath.h hxcom.h \
     nurbs.hh stddef.h krb5.h MainHelix.h dllpath.h hxcom.h \
     hxcomm.h hxcore.h hxengin.h hxerror.h hxfiles.h hxtbuf.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 \
     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 \
     avcodec.h avformat.h avio.h avutil.h swscale.h integer.h \
     intfloat_readwrite.h mathematics.h rational.h rtp.h \
     intfloat_readwrite.h mathematics.h rational.h rtp.h \
     rtsp.h rtspcodes.h setjmp.h tinyxml.h winsock2.h \
     rtsp.h rtspcodes.h setjmp.h tinyxml.h winsock2.h \

+ 8 - 0
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

+ 0 - 0
dtool/src/parser-inc/highgui.hpp


+ 13 - 1
panda/src/vision/openCVTexture.h

@@ -20,10 +20,22 @@
 
 
 #include "videoTexture.h"
 #include "videoTexture.h"
 
 
-#include <cxcore.h>
+// 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 <opencv2/core/core.hpp>
+//#include <opencv2/video/video.hpp>
+#include <opencv2/highgui/highgui.hpp>
+
+#else
 #include <cv.h>
 #include <cv.h>
+#include <cxcore.h>
 #include <highgui.h>
 #include <highgui.h>
 
 
+#endif  // OPENCV_VER_23
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //       Class : OpenCVTexture
 //       Class : OpenCVTexture
 // Description : A specialization on VideoTexture that takes its input
 // Description : A specialization on VideoTexture that takes its input