赞
踩
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时,检测一张图像中多张人脸时出现以上问题。在网上搜了很多,最终选择询问李博士。
解决方法:
- old_image = np.int32(old_image)
- cv2.rectangle(old_image, (b[0], b[1]), (b[2], b[3]), (0, 0, 255), 2)
成功解决。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。