Eko Rudiawan
Eko Rudiawan

Reputation: 187

Template for Generalized Hough Transform OpenCV Python

I'm rather confused how to use a generalized Hough transform with openCV Python. When I set a template with a ROI of grayscale image, it shows this error:

Incorrect type of self (must be 'GeneralizedHough' or its derivative)

Here is my example code:

alg = cv.GeneralizedHoughGuil()
# Simple create template with 1 channel black images with size 5x5
template = np.zeros((5,5))
alg.setTemplate(template)

Upvotes: 4

Views: 2807

Answers (2)

Zubiao Xiong
Zubiao Xiong

Reputation: 41

Call cv.createGeneralizedHoughGuil instead of cv.GeneralizedHoughGuil:

alg = cv.createGeneralizedHoughGuil()
template = np.zeros((5,5))
alg.setTemplate(template)

Upvotes: 4

MrLebovsky
MrLebovsky

Reputation: 88

As I know the only way out in this situation is to rebuild OpenCV with CV_EXPORTS_W and CV_WRAP directives. answers.opencv topic

Upvotes: 0

Related Questions