2 u012842664 u012842664 于 2014.10.10 15:53 提问

opencv houghlines出错

我用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

请问这是怎么回事??

1个回答

even_01
even_01   2016.09.15 16:18

现在解决了吗? 我是一运行houghlines程序就崩掉,主要跟那个houghlines最后一个参数有关,参数值太小就崩掉。

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!