我正在尝试为OpenCL使用OpenCV(3.0 beta)transparant API,但我对简单操作(至少对于加法和减法)有奇怪的编译错误。
以下是一个示例代码:
#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;
}
我收到了这个错误:
/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;
^
这与减法相同。 我无法找到任何有同样错误的人。我做错了吗?