pythoncv2报错. Can‘t parse ‘pt2
cv2.rectangle(img, (240, 0), (480.2, 375), (0, 255, 0), 2)报错:Traceback (most recent call last):File "/root/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3418, in run_co
·
cv2.rectangle(img, (240, 0), (480.2, 375), (0, 255, 0), 2)
报错:
Traceback (most recent call last):
File "/root/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3418, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-10-5766022a9827>", line 1, in <module>
cv2.rectangle(img, (240, 0), (480.2, 375), (0, 255, 0), 2)
cv2.error: OpenCV(4.5.2) :-1: error: (-5:Bad argument) in function 'rectangle'
> Overload resolution failed:
> - Can't parse 'pt2'. Sequence item with index 0 has a wrong type
> - Can't parse 'pt2'. Sequence item with index 0 has a wrong type
> - Can't parse 'rec'. Expected sequence length 4, got 2
> - Can't parse 'rec'. Expected sequence length 4, got 2
原因是中间的坐标不能有小数。。。。
把480.2换成480 就好了
更多推荐
已为社区贡献1条内容
所有评论(0)