OpenCV-Python build problem with HoughCircles function

asked 2013-09-24 01:04:52 -0500

updated 2013-09-24 02:15:17 -0500

The code is:

hougharr=opencv.CreateMemStorage(0)#64k
result=opencv.HoughCircles(edge,hougharr,opencv.CV_HOUGH_GRADIENT,2,edge.width/10)

and the error code is:

TypeError: Argument 'circle_storage' must be CvMat. Use fromarray() to convert numpy arrays to CvMat

ANOTHER PROBLEM:

The code is:

hougharr=opencv.CreateMemStorage(0)#64k
opencv.fromarray(hougharr)
result=opencv.HoughCircles(edge,hougharr,opencv.CV_HOUGH_GRADIENT,2,edge.width/10)

and the error code is:

TypeError: object does not have array interface

What should I do to correct the mistakes?

edit retag flag offensive close merge delete

Comments

2

hmm, that's not cv2, right ? so, what kind of odd wrapper ayou using there ? ( it also seems to wrap the old c-api )

berak gravatar imageberak ( 2013-09-24 01:46:12 -0500 )edit

hi! It's cv2, version 2.4.6, and with Python2.7.5 on windows sys. The symbol 'opencv' is the cv2.cv and in the program is : import cv2.cv as opencv

AlexLEE gravatar imageAlexLEE ( 2013-09-24 04:08:16 -0500 )edit

I'm a newer. Learning python language is just a few days.

AlexLEE gravatar imageAlexLEE ( 2013-09-24 04:11:33 -0500 )edit
1

ah, ok. but please don't use cv2.cv, that's the old deprecated api. won't be available in the next version

stick with cv2, there's even a demo for it

you still might have to use cv2.cv to access some constants, it's a bit work in progress there

berak gravatar imageberak ( 2013-09-24 04:12:19 -0500 )edit