当前位置:网站首页>解决::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
边栏推荐
猜你喜欢

Dolphinscheduler调度sql任务建表时The query did not generate a result set异常解决

专用窗口函数rank, dense_rank, row_number

Redis practice notes and source code analysis

ACFS文件系统创建扩大缩小等配置步骤

Prometheus Thanos快速指南

冬季实战营 动手实战-MySQL数据库快速部署实践 领鼠标 云小宝

Introduction to common APIs for EBFP programming

Prometheus thanos Quick Guide

Chaos takes you to the chaos project quickly

Analysis of Rdam principle
随机推荐
冬季实战营动手实战-上云必备环境准备,动手实操快速搭建LAMP环境 领鼠标 云小宝 背包 无影
异常记录-9
Abnormal record-18
Exception record-9
基于EMR离线数据分析-反馈有礼
异常记录-20
异常记录-13
异常记录-14
OSS云存储管理实践(体验有礼)
Django::Did you install mysqlclient?
测试oracle库700万数据量普通方式创建索引所需时间
Exception record-7
关于Postgres主从复制延迟监控的错误告警问题
异常记录-21
实践使用PolarDB和ECS搭建门户网站
Exception record-5
Oracle RAC数据库实例启动异常问题分析IPC Send timeout
异常记录-22
Try catch cannot catch asynchronous errors
Prometheus Cortex架构概述(水平可扩展、高可用、多租户、长期存储)