为什么我用opencv和houghlines会出现这个错误?

时间:2012-12-15 21:43:19

标签: opencv hough-transform

我正在使用VS2010,OpenCV 2.1,Windows XP,我收到错误:内存位置异常

通常这是因为某些内容为NULL,但事实并非如此:

VideoCapture cap =  VideoCapture(); // open the default camera
cap.open("smartbeam1.avi");
if(!cap.isOpened())  // check if we succeeded
    return -1;

Mat edges,color_dst;
Mat frame ;

namedWindow("original",1);
namedWindow("edges",1);

for(;;)
{
    cap >> frame; // get a new frame from camera
    cvtColor(frame, edges, CV_BGR2GRAY);
    GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
    Canny(edges, edges, 0, 30, 3);

//Houg
    vector<Vec2f> lines;
    **HoughLines(edges, lines, 1, CV_PI/180, 100 );//I Get Location Memory**
...
}

1 个答案:

答案 0 :(得分:0)

最佳使用

矢量线; HoughLinesP(edge,lines,1,CV_PI / 180,threshold,minLineLengh,maxLineGap);