CRAFT-pytorch icon indicating copy to clipboard operation
CRAFT-pytorch copied to clipboard

Polylines bad argument: expected Ptr<cv::UMat> for argument 'img'

Open LiamSimons opened this issue 2 years ago • 2 comments

Only for some images the text detection fails with the error: cv2.polylines(img, [poly.reshape((-1, 1, 2))], True, color=(0, 0, 255), thickness=2) cv2.error: OpenCV(4.6.0) :-1: error: (-5:Bad argument) in function 'polylines'

Overload resolution failed:

  • Layout of the output array img is incompatible with cv::Mat
  • Expected Ptrcv::UMat for argument 'img'

I have looked for a difference between the working and to failed images but cannot seem to find a difference?

LiamSimons avatar Aug 24 '22 08:08 LiamSimons

I don't understand the question properly, but in my experience, this error occurs when opencv expects a numpy array, and most of the time its receiving None instead of a numpy array, and that could happen by a lot of different reasons, but its usually a problem at loading the image

GabrielDornelles avatar Aug 29 '22 02:08 GabrielDornelles

Have you check the values of the predicted boxes?

Maybe it's the similar problem that I have recognized and fixed: https://github.com/clovaai/CRAFT-pytorch/pull/198

Acinonyx4 avatar Aug 18 '23 23:08 Acinonyx4