Detecting tennis balls with HoughCircles

asked 2019-07-01 09:06:16 -0600

Hi there,

I'm new to OpenCV and struggling to use HoughCircles to detect a tennis ball in a jpg image.

The image has dimensions of 2016x1512px. The tennis ball in the image has a diameter of roughly 360px.

        Console.WriteLine("Detect circle in jpg");

        Mat src1 = new Mat(@"TestData\BowlDefiniteEdgfe.jpg", ImreadModes.Grayscale);
        Mat dst1 = new Mat();

        dst1 = src1.GaussianBlur(new Size(13, 13), 0/*sigmaX*/);
        CircleSegment[] circles1 = dst1.HoughCircles(HoughMethods.Gradient,1/*dp*/, 20/*minDist*/);

I do not understand if I am using suitable parameters for HoughCircle, specifically the second (dp) and the final one (minDist)? I've uploaded the photo but not sure it uploaded successfully.

Note the actually Nuget library was OpenCvSharp3.


edit retag flag offensive close merge delete



please understand, that we can't help you with c# specific problems, opencv does neither maintain OpenCvSharp3 , nor any nuget repos

berak gravatar imageberak ( 2019-07-01 10:08:35 -0600 )edit