cnts = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = imutils.grab_contours(cnts)
X = []
Y = []
for c1 in cnts:
# compute the center of the contour
M = cv2.moments(c1)
cX = int(M["m10"] / M["m00"])
cY = int(M["m01"] / M["m00"])
cv2.drawContours(imCrop, [c1], -1, (0, 255, 0), 2)
cv2.circle(imCrop, (cX, cY), 7, (255, 255, 255), -1)
X.append(cX)
Y.append(cY)
我一直得到以下错误,我没有线索。当我去掉需要存储的X.append(cX)和Y.append(cY)(记录多帧的所有质心坐标)时,它确实消失了。我已经检查了很多次间距/制表符问题,但实际上是这些list.append行导致了错误。有什么想法吗
X.append(cX)
^
IndentationError: unindent does not match any outer indentation level
尝试只使用空格进行缩进,以匹配缩进级别
从行首开始,数四次:)
相关问题 更多 >
编程相关推荐