简体   繁体   English

如何获得 OpenCV 霍夫圆变换 C++ 中的圆数

[英]How to get number of circles in OpenCV Hough Circle Transformation C++

I am testing the following;我正在测试以下内容;

[https://docs.opencv.org/3.4/d4/d70/tutorial_hough_circle.html][1] [https://docs.opencv.org/3.4/d4/d70/tutorial_hough_circle.html][1]

and it seems to be running fine.它似乎运行良好。 My question is how to get the number of circles in the image?我的问题是如何获得图像中的圆圈数?

There is no direct way to get the number of circles in an OpenCV Hough Circle Transformation.没有直接的方法来获得 OpenCV 霍夫圆变换中的圆数。 However, you can use the cv::HoughCircles function to get the coordinates of the circles, and then use the cv::countNonZero function to count the number of non-zero pixels in the image.但是,您可以使用 cv::HoughCircles function 来获取圆的坐标,然后使用 cv::countNonZero function 来计算图像中非零像素的数量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM