当前位置:网站首页>解决::Argument ‘radius‘ is required to be an integer
解决::Argument ‘radius‘ is required to be an integer
2022-04-23 06:05:00 【贾岚翔】
cv2.error: OpenCV(3.4.14) :-1: error: (-5:Bad argument) in function 'circle'
> Overload resolution failed:
> - Argument 'radius' is required to be an integer
> - Argument 'radius' is required to be an integer
问题描述:在opencv编程,画出圆形时报错,代码为
cv2.circle(image, (x + w/2, y + w/2), w/2, (152, 251, 152), 1) # 画圆形
上述代码块中w/2为半径
原因:整数除以2可能会存在有小数点的情况,半个像素无法处理,必须将r转化成整数int型。
解决方案:
将w/2变为整型::
r = math.ceil(w/2)
代码意义:Math.ceil() “向上取整”, 即小数部分直接舍去,并向正数部分进1
案例: math.ceil(3.1415926)后结果为4
提示:需要
import math
版权声明
本文为[贾岚翔]所创,转载请带上原文链接,感谢
https://jialanxiang.blog.csdn.net/article/details/121359057
边栏推荐
猜你喜欢
Ali vector library Icon tutorial (online, download)
Thanos Compactor组件使用
Introduction to DDoS attack / defense
Build an OSS based image sharing website - polite feedback
Chaos takes you to the chaos project quickly
Memcached source code analysis
Prometheus的relabel_configs和metric_relabel_configs解释及用法示例
Static interface method calls are not supported at language level ‘5‘ 异常解决
Relabel of Prometheus_ Configs and metric_ relabel_ Configs explanation and usage examples
搭建基于OSS的图片分享网站-反馈有礼
随机推荐
Static interface method calls are not supported at language level ‘5‘ 异常解决
BCC installation and basic tool instructions
Oracle RAC数据库实例启动异常问题分析IPC Send timeout
专用窗口函数rank, dense_rank, row_number
Winter combat camp hands-on combat - cloud essential environment preparation, hands-on practical operation, quickly build lamp environment, lead mouse cloud Xiaobao backpack without shadow
mysql和pg库遇到冲突数据时的两种处理方式
TC ebpf practice
Typical application scenarios of alicloud log service SLS
异常记录-17
Abnormal record-19
Chaos带你快速上手混沌工程
关于我
PG SQL截取字符串到指定字符位置
Prometheus alarm record persistence (historical alarm saving and Statistics)
搭建基于OSS的图片分享网站-反馈有礼
使用prom-label-proxy实现Prometheus Thanos的基于标签的多租户读
Construire un blog Cloud basé sur ECS (bénédiction sur le Code Cloud Xiaobao, explication détaillée de la tâche iphone13 gratuite)
Redis FAQ
JS function package foreach use return can not jump out of the outer function
基於ECS搭建雲上博客(雲小寶碼上送祝福,免費抽iphone13任務詳解)