Ask Your Question

How to utilize opencv3.1.0's GeneralizedHough

asked 2016-09-04 16:50:14 -0500

bradfield gravatar image

updated 2016-09-05 00:40:08 -0500

berak gravatar image

I am wondering if it is possible to actually use the Generalized Houghtransform which is available in version 3.1.0.

How can I perform generalized Hough transform in python? The generalizedHough is different from, for example, functions like HoughLines. It can not be simply called. Something is missing, to be able to simply access it with a one-line python call (its called wrapper? the thing which is missing?)

edit retag flag offensive close merge delete


unfortunately, neither GeneralizedHoughBallard, nor GeneralizedHoughGuil are available from python atm. (you guessed right, the wrapper is missing)

berak gravatar imageberak ( 2016-09-05 04:30:51 -0500 )edit

What else is not accessible with python? Do you think it would be generally better to use c++ instead of python, to get the most performance out of opencv? For example I also found functions like parallelCanny, which also lacks a python wrapper. I need to execute this on a raspberry pi 3, and since it has 4 cores a parallelCanny is beneficial. So far my scripts only execute on a single core.

bradfield gravatar imagebradfield ( 2016-09-05 11:22:40 -0500 )edit

it may be just bad luck on your side. the python bindings cover ~95% of the c++ api, and the remaining 5% are more or less WIP.

berak gravatar imageberak ( 2016-09-05 11:50:53 -0500 )edit

adding the missing wrapper functionality is not so difficult . you need the CV_EXPORTS_W part for GeneralizedHough, GeneralizedHoughBallard, and GeneralizedHoughGuil, all functions you need to use need CV_WRAP, and GeneralizedHoughBallard, and GeneralizedHoughGuil,need a static create() function, returning a cv::Ptr.

berak gravatar imageberak ( 2016-09-05 11:57:31 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-09-05 04:24:24 -0500

It is crazy how easy it is to find a solution for generalized hough transform using OpenCV through a simple google search ... complete with tutorial and source code!

edit flag offensive delete link more


yes I know that page, but this one is written in c++, and may not be able to simply transfer it, not to speak about efficient implementation. My hope was that the GeneralizedHough implementation has already been optimized. How problematic is it to write a wrapper for opencv's generalized Hough?

bradfield gravatar imagebradfield ( 2016-09-05 10:53:22 -0500 )edit

nice tutorial, but it's not actually using opencv's generalized hough implementation..

berak gravatar imageberak ( 2016-09-05 11:51:57 -0500 )edit

Question Tools

1 follower


Asked: 2016-09-04 16:50:14 -0500

Seen: 932 times

Last updated: Sep 05 '16