更新时间:2022-06-24 03:07:49
我的问题是numpy.array
默认情况下会创建int64
位数字.所以我必须将其显式转换为int32
:
The problem in my case was that numpy.array
created int64
-bit numbers by default. So I had to explicitly convert it to int32
:
points = np.array([[910, 641], [206, 632], [696, 488], [458, 485]])
# points.dtype => 'int64'
cv2.polylines(img, np.int32([points]), 1, (255,255,255))
(看起来像cv2 python绑定中的错误,应该已经验证了dtype
)
(Looks like a bug in cv2 python binding, it should've verified dtype
)