English 中文(简体)
Opencv cvHough Circles-Paraters 疑点
原标题:Opencv cvHoughCircles-Parameters doubts
  • 时间:2012-05-25 12:03:44
  •  标签:
  • opencv

我对cvHough Circles 参数有些怀疑。 我有一个图像, 有一些圆圈, 我想计数它们, 伯爵给了我错误的圆圈数 。

所以我不知道如何选择一些函数参数,比如:

dp,min_dist,param1,param2,min_radius, max_radius.

我不知道我在这个参数中使用了什么数字。我怎么计算这个数字?

问题回答

选择参数取决于您正在使用的图像。 参数本身的解释可见于此引用

http://opencv.willowgarage.com/document/cpp/imgproc_feature_detection.html#cv-houghcircles

使用包含以下参数的函数

HoughCircles(gray, circles, CV_HOUGH_GRADIENT,2, gray->rows/4, 200, 100, 10, 50);

将使得它搜索以 2 dp 2 的圆圆圆, 最小距离为图像的 1/4 圆和累积值的 最大 200 100, 以决定什么可以接受为圆。 10 和 50 是圆可以接受的最小和最大半径 。

如果您找不到这些参数, 请尝试做一个测试程序, 将这些值附加到滑动器上, 这样您就可以在测试图像上看到结果 。

特别是 param2 是 测量 难以 确定 的 。 因为您知道 图像中有多少圆圈, 您可以用以下方式进行参数爬行 :

for(int i=0;i<200;i++) {
 cv::HoughCircles(gray, circles, CV_HOUGH_GRADIENT,2, gray->rows/4, 200, i, 10, 50);
 std::cout<<"HoughCircles with param2="<<i<<" gives "<<circles.size()<<" circles"<<endl;
}

我不知道 param1 和 2 是如何完全相联的, 但是您也可以使用双倍的双圈来找到最佳的循环。 其它值需要从图片中测量。 而不是制作截图, 您也可以用此函数保存此图像 :

cvSaveImage("image.jpg",gray);

以确保你真的在量度准确的画面。





相关问题
Python/OpenCV: Converting images taken from capture

I m trying to convert images taken from a capture (webcam) and do some processing on them with OpenCV, but I m having a difficult time.. When trying to convert the image to grayscale, the program ...

How to smooth a histogram?

I want to smooth a histogram. Therefore I tried to smooth the internal matrix of cvHistogram. typedef struct CvHistogram { int type; CvArr* bins; float thresh[CV_MAX_DIM][2]; /* ...

Testing complex datatypes?

What s are some ways of testing complex data types such as video, images, music, etc. I m using TDD and wonder are there alternatives to "gold file" testing for rendering algorithms. I understand that ...

Displaying OpenCV iplimage data structures with wxPython

Here is my current code (language is Python): newFrameImage = cv.QueryFrame(webcam) newFrameImageFile = cv.SaveImage("temp.jpg",newFrameImage) wxImage = wx.Image("temp.jpg", wx.BITMAP_TYPE_ANY)....

What is the memory structure of OpenCV s cvMat?

Imagine I have the following: CvMat* mat = cvCreateMat(3,3,CV_16SC3) This is a 3x3 matrix of integers of channel 3. Now if you look at OpenCV documentation you will find the following as the ...

Face detection and comparison

I m running a small research on face detection and comparison for my article. Currently, I m using rapid face detection based on haar like features based on OpenCV cascade (I ll implement learning ...

热门标签