J
J
Julia2017-07-03 13:12:03
OpenCV
Julia, 2017-07-03 13:12:03

How to identify a circle in an image?

Good afternoon. I want to find the coordinates of these little circles. But the below code doesn't find anything. How do I change definition settings. Or how to deal with the image.

cvtColor(img, gray, CV_BGR2GRAY);
    //cvtColor(img, HSV, COLOR_BGR2HSV);
    //GaussianBlur(gray, gray, Size(9, 9), 2, 2);


    std::vector<Vec3f> circles;



    HoughCircles(gray, circles, HOUGH_GRADIENT, 1,100, 200, 100, 0, 0);

    for (size_t i = 0; i < circles.size(); i++)
    {
      Vec3i c = circles[i];
      circle(img, Point(c[0], c[1]), c[2], Scalar(0, 0, 255), 3, LINE_AA);
      circle(img, Point(c[0], c[1]), 2, Scalar(0, 255, 0), 3, LINE_AA);
    }

Thanks for your help.
This is my original Infrared image .
d903eddfb813491094a64ae89a2f5d39.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2017-09-09
@2ord

And if you apply a filter to highlight the contour, for example, Sobel?
And after it cv::HoughCircles .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question