1
我正在使用以下代碼來檢測模式。爲什麼會拋出TypeError?TypeError:預期的整數參數,得到浮點python 2.7
# loop over the contours
對C中的CNT:
# compute the center of the contour
M = cv2.moments(c)
cX = (M["m10"]/(M["m00"] + 1e-7))
cY = (M["m01"]/(M["m00"] + 1e-7))
# draw the contour and center of the shape on the image
cv2.drawContours(frame1, [c], -1, (0, 255, 0), 2)
cv2.circle(frame1, (cX, cY), 7, (255, 255, 255), -1)
cv2.putText(frame1, "center", (cX - 20, cY - 20),
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 2)
這種按摩錯誤
cv2.circle(frame1, (cX, cY), 7, (255, 255, 255), -1)
類型錯誤:整數參數預期,得到浮
opencv想要[circle center](http://docs.opencv.org/3.0-beta/modules/imgproc/doc/drawing_functions.html)具有整數座標 – slawekwin
我模仿程序的人,在他的程序中就可以。但我不。 我覺得上面的程序是合適的 –