Ask Your Question

Generalized hough transform implementation in Opencv?

asked 2016-12-26 00:25:31 -0500

Some One gravatar image

From this question on stack overflow i know there is no opencv implementation for generalized hough tranform but in the opencv documentation here there is cv::GeneralizedHough class what does this class do? I know SIFT and SURF are good at object recognition but recognize small and specific shaped objects in image i think generalized hough tranform is good. Example for the image below which algorithm is good? image description

edit retag flag offensive close merge delete


what's actually in that picture ? sleeping sickness ?

berak gravatar imageberak ( 2016-12-28 10:33:04 -0500 )edit

i don't know i just take a random image

Some One gravatar imageSome One ( 2016-12-28 11:49:06 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-12-26 10:15:26 -0500

Tetragramm gravatar image

That SO question is pretty old. If you look at the link to the documentation, you can see that the GeneralizedHough class is a base class for two implementations, the Ballard and the Guil. Because it's a base class, you can case a pointer from either sub-class into it and use it the same in your code, as long as you only use functions in the base class. That reduces duplication of code if you want to switch back and forth between them. If you're just using one, just have a pointer to that class and don't worry about it.

The Ballard says it detects position only, without translation and rotation. I'm not actually sure what that means, "without translation". It may mean scale. Either way, this is the fastest, and probably what you want. Your round things there are rotation invariant, and without the rotation and scale, it's much faster.

The Guil transform does do rotation and scale, so it's useful in more situations, but it's much slower because it has two more dimensions to search.

edit flag offensive delete link more


Thanks can you suggest me any tutorial or book on how to use the Generalized Hough transform the documentation doesn't have clear how to use instruction.

Some One gravatar imageSome One ( 2016-12-27 05:38:39 -0500 )edit

I don't know where a tutorial is, but I can clarify the documentation a bit.

  1. You set as many of the parameters as you want different from default.
  2. You put in a CV_8UC1 template using the setTemplate function.
  3. You call detect on an image. the output types are vector<vec4f> and votes is vector<vec3i>

For Ballard you only use the x and y on the positions, and the first variable on votes, the rest are constant. I assume those are for rotation and scale on Guil.

Tetragramm gravatar imageTetragramm ( 2016-12-27 11:20:29 -0500 )edit

Question Tools

1 follower


Asked: 2016-12-26 00:18:27 -0500

Seen: 2,981 times

Last updated: Dec 26 '16