How to crop circles (found with Hough Transform) in OpenCV?

前端 未结 4 1679
轻奢々
轻奢々 2021-01-25 13:04

I\'m using the code from the page. It works very well and I get a circle that I am looking for. All my image have only 1 circle and I have modified parameters of HoughCirc

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-25 13:37

    HoughCircles(src, circles, CV_HOUGH_GRADIENT, 1, parameter_1, parameter_2, parameter_3, parameter_4, parameter_5);
    
    for (size_t i = 0; i < circles.size(); i++)
    {
        Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
        int radius = cvRound(circles[i][2]);
        circleroi = src(Rect(center.x - radius, coordinate
                        center.y - radius, 
                        radius *2,         
                        radius * 2));       
    }
    

提交回复
热议问题