这段代码:
import cv2
img = cv2.imread('circles.jpg',0)
img = cv2.medianBlur(img,5)
cimg = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)
circles = cv2.HoughCircles(img,cv2.cv.HOUGH_GRADIENT,1,20,
param1=50,param2=30,minRadius=0,maxRadius=0)
引发以下错误:
Traceback (most recent call last):
File "C:\Users\Arnaud\Desktop\Cercles\circles.py", line 8, in <module>
circles = cv2.HoughCircles(img,cv2.cv.HOUGH_GRADIENT,1,20,
AttributeError: 'module' object has no attribute 'HOUGH_GRADIENT'
你知道为什么请吗?
答案 0 :(得分:2)
改为使用cv2.cv.CV_HOUGH_GRADIENT
。