8000 Fix for OpenCV 4 · sibaba8888/matplotlib-cpp@2772217 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2772217

Browse files
alexdewarlava
authored andcommitted
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.
1 parent 5dd7194 commit 2772217

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

matplotlibcpp.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@
1717
# include <numpy/arrayobject.h>
1818

1919
# ifdef WITH_OPENCV
20-
# include <opencv2/opencv.hpp>
20+
# include <opencv2/opencv.hpp>
2121
# endif // WITH_OPENCV
22+
23+
/*
24+
* A bunch of constants were removed in OpenCV 4 in favour of enum classes, so
25+
* define the ones we need here.
26+
*/
27+
# if CV_MAJOR_VERSION > 3
28+
# define CV_BGR2RGB cv::COLOR_BGR2RGB
29+
# define CV_BGRA2RGBA cv::COLOR_BGRA2RGBA
30+
# endif
2231
#endif // WITHOUT_NUMPY
2332

2433
#if PY_MAJOR_VERSION >= 3

0 commit comments

Comments
 (0)
0