Bläddra i källkod

Fix for OpenCV 4
In the latest version of OpenCV, several constants were removed in
favour of enum classes. Fix by #define'ing the ones we need.

Alex Dewar 5 år sedan
förälder
incheckning
2772217011
1 ändrade filer med 10 tillägg och 1 borttagningar
  1. 10 1
      matplotlibcpp.h

+ 10 - 1
matplotlibcpp.h

@@ -17,8 +17,17 @@
 #  include <numpy/arrayobject.h>
 
 #  ifdef WITH_OPENCV
-#  include <opencv2/opencv.hpp>
+#    include <opencv2/opencv.hpp>
 #  endif // WITH_OPENCV
+
+/*
+ * A bunch of constants were removed in OpenCV 4 in favour of enum classes, so
+ * define the ones we need here.
+ */
+#  if CV_MAJOR_VERSION > 3
+#    define CV_BGR2RGB cv::COLOR_BGR2RGB
+#    define CV_BGRA2RGBA cv::COLOR_BGRA2RGBA
+#  endif
 #endif // WITHOUT_NUMPY
 
 #if PY_MAJOR_VERSION >= 3