Is it possible to access the Hough transform accumulator using opencv?

Asked

Viewed 245 times

2

I am with this small prolema, I searched a lot on the internet and in the documentation but I did not find anything related, I need to know what the accumulation value of each circle generated by the function, example: center circle (x,y) r radius had 50 accumulation points

In my case, I need to know which circle had the greatest accumulation, because this is the only circle that interests me among all generated!

  • 1

    Man, this is already implemented in the function itself and it will return the most evident circles. If you want, you can define the size of the radius of the circle you want to find, or you can show the circle that is in a certain pixel neighborhood.

  • Related: http://answall.com/q/124576/73

1 answer

2

A long time later I discovered that the vector of circles returned comes ordered according to those who obtained the largest vote, so the circle of index 0 is the best circle among all.

    Mat out;
    vector<Vec3f> circles
    houghCirclesHoughCircles(inputImg, circles, method, dp, minDist, param1, param2, minRadius, maxRadius);
    ///desenhando circulo mais votado em uma imagem de mesmo tamanho da imagem original
    if (!circles.empty()) {
        Point center(circles[0][0], circles[0][1]);
        int raio = circles[0][2];
        out = Mat::zeros(inputImg.size(), inputImg.type());
        circle(out, center, raio, FScalar(0, 0, 255), -1);
    }
    return out;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.