python中使用len()函数报错TypeError: 'float' object is not callable
def drawShape(src,points):
i=0
while i< len(points) :
if (i==len(points)-1):
x,y=points[i][0] #points是三层的结构
x1,y1=points[0][0]
cv2.lines(src,(x,y),(x1,y1),(0,0,255),1)
else:
x,y=points[i][0] #points是三层的结构
x1,y1=points[i+1][0]
cv2.lines(src,(x,y),(x1,y1),(0,0,255),1)
i=i+1
contours,hierarchy=cv2.findContours(binary,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
print(contours)
e=20
approx=cv2.approxPolyDP(contours[15],e,True)
drawShape(img,approx)
cv2.imshow('img',img)
cv2.waitKey(0)
TypeError Traceback (most recent call last)
-> 3 while i< len(points) :
4 if (i==len(points)-1):
5 x,y=points[i][0] #points是三层的结构
TypeError: 'float' object is not callable
TypeError: 'float' object is not callable