本文最后更新于:2024年1月14日 晚上

本文记录在使用Python中的Opencv库的过程中踩过的坑,以史为鉴。

cv2.rectangle

问题

  • {TypeError}an integer is required (got type tuple)
  • {TypeError}argument for rectangle() given by name (‘color’) and position (3)
  • {TypeError}argument for rectangle() given by name (‘thickness’) and position (4)
  • {TypeError}an integer is required (got type tuple)

解决办法

  • 坐标pt1,pt2需要是整型
  • img=np.ascontiguousarray(img),然后调用rectangle

参考资料



文章链接:
https://www.zywvvd.com/notes/coding/python/opencv-error/opencv-error/


“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付

Python Opencv 错误记录
https://www.zywvvd.com/notes/coding/python/opencv-error/opencv-error/
作者
Yiwei Zhang
发布于
2021年1月14日
许可协议