【bug】PPOCRLabel p.drawRect(self, rect: QRectF): argument 1 has unexpected type ‘float‘ TypeError: ar

【bug】PPOCRLabel p.drawRect(self, rect: QRectF): argument 1 has unexpected type ‘float’ TypeError: arguments did not match any overloaded call

环境

win 11
python 3.10

opencv-contrib-python 4.10.0.84
opencv-python         4.10.0.84
paddleocr             2.8.1
paddlepaddle          2.5.2
PPOCRLabel            2.1.3
PyQt5                 5.15.11
PyQt5-Qt5             5.15.2
PyQt5_sip             12.15.0
xlrd                  1.2.0

详情

在使用PPOCRLabel工具进行矩形标注时弹出的错误,PPOCRLabel为标注ocr数据集的工具。

bug 详细输出

Traceback (most recent call last):
File "xxx\lib\site-packages\PPOCRLabel\libs\canvas.py", line 596, in paintEvent
	p.drawRect(leftTop.x(), leftTop.y(), rectWidth, rectHeight)
TypeError: arguments did not match any overloaded call:
drawRect(self, rect: QRectF): argument 1 has unexpected type 'float'
drawRect(self, x: int, y: int, w: int, h: int): argument 1 has unexpected type 'float'
drawRect(self, r: QRect): argument 1 has unexpected type 'float'

原因:从输出可以发现,这是由于drawRect函数的输入坐标为float 类型引发的错误。

实际上,drawRect函数的输入坐标应该为整型int

解决方法

找到出现bug的canvas.pypaintEvent函数的 p.drawRect(leftTop.x(), leftTop.y(), rectWidth, rectHeight)

将里面坐标值强制转为int

p.drawRect(int(leftTop.x()), int(leftTop.y()), int(rectWidth), int(rectHeight))

参考

paddle label矩形标注闪退

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值