1
パターンを検出するために次のコードを使用しています。なぜ型エラーを投げるのですか?カーボンナノチューブにおけるcに対するTypeError:整数の引数が必要です。浮動小数点数のPython 2.7
# loop over the contours
:
# 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)
はTypeError:期待される整数の引数は、
opencvは円の中心(http://docs.opencv.org/3.0-beta/modules/imgproc/doc/drawing_functions.html)に整数座標を持たせたい – slawekwin
私は彼のプログラム上でプログラムの人を模倣します。しかし、私はしません。 私は上記のプログラムが適切だと思います –