I am trying to detect this circle using Houghcircle in open cv2, but am getting an error.
below is my code
chh = cv2.HoughCircles(crr, cv2.HOUGH_GRADIENT, 1,minDist = 50, param1 =200,
param2 = 18, minRadius = 20, maxRadius =60)
[2]
ch = np.uint16(np.around(ch)) #error appears to come from here
Am assuming the 1 finds the circles while [2] converts it into an array,am suspecting np.around
.
An explanation would be greatly valued. Kind regards.
full error:
AttributeError Traceback (most recent call last) C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py in _wrapfunc(obj, method, *args, **kwds) 55 try: ---> 56 return getattr(obj, method)(*args, **kwds) 57
AttributeError: 'NoneType' object has no attribute 'round'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last) in ----> 1 ch = np.uint16(np.around(ch)) #error appears to come from here
C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py in around(a, decimals, out) 3005 3006 """ -> 3007 return _wrapfunc(a, 'round', decimals=decimals, out=out) 3008 3009
C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py in _wrapfunc(obj, method, *args, **kwds) 64 # a downstream library like 'pandas'. 65 except (AttributeError, TypeError): ---> 66 return _wrapit(obj, method, *args, **kwds) 67 68
C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py in _wrapit(obj, method, *args, **kwds) 44 except AttributeError: 45 wrap = None ---> 46 result = getattr(asarray(obj), method)(*args, **kwds) 47 if wrap: 48 if not isinstance(result, mu.ndarray):
AttributeError: 'NoneType' object has no attribute 'rint'
ch
in [2] is not defined. You are creatingchh
in [1] – Dschoni