我用opencv进行HoughLines变换的时候,前面canny边缘检测都是没事的,后面进行houghlines变换的时候程序崩溃了
int main(){
//载入原始图像
Mat src = imread("pic1.png");
Mat img1,img2;//临时变量和目标图的定义
Canny(src, img1, 50, 200, 3);
cvtColor(img1,img2, CV_GRAY2BGR);
vector<Vec2f> lines;
HoughLines(img1, lines, 1, CV_PI/180, 150, 0, 0 );
//cout<<lines.size();
for( size_t i = 0; i < lines.size(); i++ )
{
float rho = lines[i][0], theta = lines[i][1];
Point pt1, pt2;
double a = cos(theta), b = sin(theta);
double x0 = a*rho, y0 = b*rho;
pt1.x = cvRound(x0 + 1000*(-b));
pt1.y = cvRound(y0 + 1000*(a));
pt2.x = cvRound(x0 - 1000*(-b));
pt2.y = cvRound(y0 - 1000*(a));
line( img2, pt1, pt2, Scalar(0,0,255), 3, CV_AA);
}
imshow("原图", src);
imshow("canny边缘检测", img1);
imshow("houghline变换", img2);
waitKey(0);
return 0;
}
ERROR: Required OpenCL device not found, check configuration:
Platform: any
Device types: GPU
Device name: any
OpenCV Error: Unknown error code -33 (Requested OpenCL device is not found) in c
v::ocl::selectOpenCLDevice, file C:\builds\master_PackSlave-win32-vc11-shared\op
encv\modules\core\src\ocl.cpp, line 2344
请问这是怎么回事??