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
我模仿程序的人,在他的程序中就可以。但我不。 我觉得上面的程序是合适的 –