Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I get a error when using HoughCircles with Python OpenCV that a module is missing [duplicate]

Tags:

python

opencv

I have a small test code block trying to process a simple photo with a ball in it:

#!/usr/local/bin/python
import cv2
import numpy as np

img = cv2.imread("b.jpg")
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
circles = cv2.HoughCircles(gray,cv2.CV_HOUGH_GRADIENT)

When I try to run this I get:

AttributeError: 'module' object has no attribute 'HOUGH_GRADIENT'

I've been installing and reinstalling for two days trying to figure out whats wrong. Any help or pointers would be appreciated!

like image 218
Fight Fire With Fire Avatar asked Mar 07 '14 04:03

Fight Fire With Fire


1 Answers

try

circles = cv2.HoughCircles(gray, cv2.cv.CV_HOUGH_GRADIENT, 1.2, 75)

works, to me

like image 90
Cletrix Avatar answered Sep 22 '22 00:09

Cletrix