Skip to content
Advertisement

Hough Circles open CV error

I am currently using HoughCircles on computer-vision but I can’t manage to make it work. How can this error be solved ?

JavaScript

Here is my code :

JavaScript

UPDATE : New error :

JavaScript

Advertisement

Answer

As @jeru-luke has told in comment, you should add img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) just before you call cv2.HoughCircles() :

JavaScript

COLOR_BGR2GRAY and not COLOR_GRAY2BGR

UPDATE:

Add nimg = cv2.cvtColor(nimg, cv2.COLOR_GRAY2BGR) just before calling get_circle for second time:

UPDATE 2

JavaScript

Result:

enter image description here

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement