【问题标题】:Why i get this error with opencv and houghlines?为什么我在使用 opencv 和 houghlines 时出现此错误?
【发布时间】:2012-12-15 21:43:19
【问题描述】:

我使用的是 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**
...
}

【问题讨论】:

  • 您的代码在 Ubuntu 12.10、Opencv 2.4.3 上运行良好。
  • 我正在使用 windows xp :( .
  • 请尝试更新的 OpenCV 版本。

标签: opencv hough-transform


【解决方案1】:

最好用

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-25
    • 2022-10-04
    • 2021-08-10
    • 1970-01-01
    • 1970-01-01
    • 2023-01-29
    • 1970-01-01
    相关资源
    最近更新 更多