это то, что вы после ...
если так это вопрос настройки нескольких параметров. В частности, минимальный и максимальный радиус круга и окружность (минимальное расстояние между обнаруженными кругами).
Gist here.
обновление
если вы хотите связать минимальный радиус до размеров изображения, вы могли бы сделать что-то вроде этого:
float minRadius = MIN(img.size().width, img.size().height) * 0.5;
и корма, что для функции houghCircles.
В PARAMS я на самом деле использовали (в соответствии с сутью):
HoughCircles( img
, circles
, CV_HOUGH_GRADIENT //method – Detection method to use.
// Currently, the only implemented method is
// CV_HOUGH_GRADIENT , which is basically 21HT ,
// described in [Yuen90].
, 1 //p – Inverse ratio of the accumulator resolution to the
// image resolution. For example, if dp=1 , the accumulator has
// the same resolution as the input image. If dp=2 ,
// the accumulator has half as big width and height.
, 60 //minDist – Minimum distance between the centers of the
// detected circles. If the parameter is too small, multiple
// neighbor circles may be falsely detected in addition to a
// true one. If it is too large, some circles may be missed.
, 100 //cannyThreshold – The higher threshold of the two
// passed to the gpu::Canny() edge detector
// (the lower one is twice smaller).
, 30 //votesThreshold – The accumulator threshold for the circle
// centers at the detection stage. The smaller it is, the more
// false circles may be detected.
, 250 //minRadius – Minimum circle radius.
, 300 //maxRadius – Maximum circle radius.
);
Комментарии сняты с openCV documentation.
Почему, по вашему мнению, проблема связана с Linux? – FooBar
Я не говорю, что это проблема Linux. Я просто хотел предоставить информацию о ОС – user2543622