Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use OpenCV GeneralizedHoughTransform class with Python?

I'm trying to code a basic example of use of GeneralizedHoughBallard class using OpenCV 4.0.0 and Python 3.6. I have found an example for C++ here https://github.com/opencv/opencv/blob/4.0.0/samples/gpu/generalized_hough.cpp but no for Python.

When I try to create a new instance of GeneralizedHoughBallard class:

import cv2
alg = cv2.createGeneralizedHoughBallard()

I get the error: "AttributeError: module 'cv2.cv2' has no attribute 'createGeneralizedHoughBallard".

I've seen in the OpenCV source (https://github.com/opencv/opencv/blob/4.0.0/modules/imgproc/include/opencv2/imgproc.hpp) that createGeneralizedHoughBallard is declared with CV_EXPORTS so I suppose it should be possible to use with Python. I've tried to use another similar function that is declared in the same file (improc.hpp) for example: cv2.createCLAHE() and works fine.

What could be the problem?