代码崩溃,而HoughCircles的opencv函数圈正在运行

时间:2016-04-28 17:11:10

标签: c++ visual-studio opencv

我收到错误消息R6010 - 在我非常简单的代码中调用了abort()。我在属性链接器输入:opencv_ts300.lib opencv_ts300d.lib opencv_world300.lib opencv_world300d.lib

cmd中的OpenCV错误:断言失败(半径> = 0&&厚度< = MAX_THICKNESS&& 0< = shift&& shift< = XY_SHIFT)cv :: circle win64 -vc12 imgproc \ src \ drawing.cpp第1746行。

我使用Visual Studio 2012 openCV 3.0.0

代码:

VideoCapture cap(0);

if ( !cap.isOpened() ) { 
     cout << "Cannot open the web cam" << endl;
     return -1;
}

vector<Vec3f> circles;
int radius;
Point center;

while (true) {
    bSuccess = cap.read(imgOriginal);

     if (!bSuccess) {     
         cout << "Cannot read a frame from video stream" << endl;
         break;
    }

    cvtColor(imgOriginal,grayImage1,COLOR_BGR2GRAY);

    GaussianBlur(grayImage1,grayImage1,Size(9,9),2,2);

    /// Apply the Hough Transform to find the circles
    HoughCircles( grayImage1, circles, CV_HOUGH_GRADIENT, 2,20,100,155,20,300 );

    /// Draw the circles detected
    for( size_t i = 0; i < circles.size(); i++ ) {
        //center(cvRound(circles[i][0]), cvRound(circles[i][1]));
        center.x = cvRound(circles[i][0]);
        center.y = cvRound(circles[i][1]);

        radius = cvRound(circles[i][2]);
        // circle center
        circle( imgOriginal, center, 3, Scalar(0,255,0), -1, 8, 0 );
        // circle outline
        circle( imgOriginal, center, radius, Scalar(0,0,255), 3, 8, 0 );
    }    

    imshow("Hough circles",imgOriginal);

namedWindow("Control", CV_WINDOW_AUTOSIZE); //create a window called "Control"
}

return 0;

有人可以帮助我吗?也许是opencv的东西?或者我认为我的笔记本电脑会导致它......

0 个答案:

没有答案