I want to detect a small white ball using "HoughCircles", I have code which detects a red ball.
I don't know how to change the color to white, because I don't understand the command " InRange" and how make it detect a very small ball?
What I have tried:
mainImage = new Image<Bgr, byte>("D://222.jpg");
processedImage = mainImage.InRange(new Bgr(0, 0, 128), new Bgr(47, 47, 255));
processedImage = processedImage.SmoothGaussian(9);
CircleF[] circles = processedImage.HoughCircles(new Gray(100), new Gray(50), 2, processedImage.Height / 4, 4, 400).SelectMany(u => u.Select(s => s)).ToArray();
foreach (var c in circles)
{
CvInvoke.Circle(mainImage, new Point((int)c.Center.X, (int)c.Center.Y), 3, new MCvScalar(0, 255, 0), -1, Emgu.CV.CvEnum.LineType.AntiAlias, 0);
mainImage.Draw(c, new Bgr(Color.Red), 3);
}
imageBox1.Image = mainImage;
imageBox2.Image = processedImage;
I dont understand the parameter of
HoughCircles
and the command
InRange(new Bgr(0, 0, 128), new Bgr(47, 47, 255));