File "D:\Code\GhostFaceNets\facenet-retinaface-pytorch-main\retinaface.py", line 460, in detect_image
cv2.rectangle(old_image, (b[0], b[1]), (b[2], b[3]), (0, 0, 255), 2)
cv2.error: OpenCV(4.9.0) :-1: error: (-5:Bad argument) in function 'rectangle'
> Overload resolution failed:
> - img marked as output argument, but provided NumPy array marked as readonly
> - Expected Ptr<cv::UMat> for argument 'img'
> - img marked as output argument, but provided NumPy array marked as readonly
> - Expected Ptr<cv::UMat> for argument 'img'
cv2.rectangle(old_image, (b[0], b[1]), (b[2], b[3]), (0, 0, 255), 2)
在调试facenet+retinaface时,检测一张图像中多张人脸时出现以上问题。在网上搜了很多,最终选择询问李博士。
解决方法:文章来源:https://www.toymoban.com/news/detail-822654.html
old_image = np.int32(old_image)
cv2.rectangle(old_image, (b[0], b[1]), (b[2], b[3]), (0, 0, 255), 2)
成功解决。文章来源地址https://www.toymoban.com/news/detail-822654.html
到了这里,关于cv2.error: OpenCV(4.9.0) :-1: error: (-5:Bad argument) in function ‘rectangle‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!