Error adding OpenCV 3.0 OpenCL UMat
I'm trying to use the OpenCV API (3.0 beta) for OpenCL, but I have strange compilation errors for simple operations (at least for addition and subtraction).
Here's some sample code:
#include <opencv2/core.hpp>
#include <opencv2/core/ocl.hpp>
#include <iostream>
using namespace std;
using namespace cv;
Mat temp;
int main() {
// activating opencl
ocl::setUseOpenCL(true);
UMat mat1 = UMat::ones(3,4,CV_32F);
UMat mat2 = UMat::ones(3,4,CV_32F);
UMat mat3;
mat3 = mat1 + mat2;
mat3.copyTo(temp);
cout << "mat3 = " << endl << " " << temp << endl << endl;
}
I am getting this error:
/home/matthieu/git/stages/singapore/opencv_perf_tests/opencl_test.cpp: In function ‘int main()’:
/home/matthieu/git/stages/singapore/opencv_perf_tests/opencl_test.cpp:19:17: error: no match for ‘operator+’ (operand types are ‘cv::UMat’ and ‘cv::UMat’)
mat3 = mat1 + mat2;
^
It's the same with subtraction. I cannot find anyone with the same error. Am I doing something wrong?
+3
source to share
No one has answered this question yet
Check out similar questions: