(-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

前端 未结 5 823
逝去的感伤
逝去的感伤 2020-12-19 00:54

I am trying to recognize text from an image to then have the text outputted; however, this error spits out:

Traceback (most recent call last):

5条回答
  •  情深已故
    2020-12-19 01:07

    This means you are passing a Uninitialized variable to

    > cv2.cvtColor()
    

    After this statement:

    # Read image with opencv
    img = cv2.imread(img_path)
    

    Can you try to print the img variable before passing to cv2.cvtColor() function

    > print(img) or print(img.shape)
    

    to make sure function call to read the image is successful

提交回复
热议问题