Skip to content

Commit fcaf7e3

Browse files
committed
OpenCV 2.4 compatibility
1 parent f49818c commit fcaf7e3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

examples/dest_gen_rects.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
#include <opencv2/opencv.hpp>
2121

2222
#include <tclap/CmdLine.h>
23-
#include <opencv2/core/ocl.hpp>
23+
24+
#include <opencv2/core/version.hpp>
25+
#if (defined(CV_VERSION_MAJOR) && CV_VERSION_MAJOR == 3)
26+
#include <opencv2/core/ocl.hpp>
27+
#endif
2428

2529
float ratioRectShapeOverlap(const dest::core::Rect &r, const dest::core::Shape &s) {
2630
Eigen::Vector2f minC = r.col(0);
@@ -102,8 +106,10 @@ int main(int argc, char **argv)
102106
// Note that OpenCV 3.0 / CascadeClassifier seems to have troubles when being reused.
103107
// Current solution is to disable OpenCL
104108
// See https://github.com/Itseez/opencv/issues/5475
105-
cv::ocl::setUseOpenCL(false);
106-
109+
#if (defined(CV_VERSION_MAJOR) && CV_VERSION_MAJOR == 3)
110+
cv::ocl::setUseOpenCL(false);
111+
#endif
112+
107113
dest::io::ShapeDatabase sd;
108114
sd.setMaxImageLoadSize(opts.loadMaxSize);
109115

0 commit comments

Comments
 (0)