且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

python中的Opencv折线函数引发异常

更新时间: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)