Skip to content

Assertion failed !ssize.empty() in function 'cv::resize' #1437

@kobruleht

Description

@kobruleht

To reproduce, run command

easyocr -l en -f c:\a\sandernestetaustagahagune.jpeg

in windows with attached file.

Exception occurs:

  File "C:\Users\kobru\AppData\Local\Programs\Python\Python313\Lib\site-packages\easyocr\easyocr.py", line 468, in readtext
    result = self.recognize(img_cv_grey, horizontal_list, free_list,\
                            decoder, beamWidth, batch_size,\
                            workers, allowlist, blocklist, detail, rotation_info,\
                            paragraph, contrast_ths, adjust_contrast,\
                            filter_ths, y_ths, x_ths, False, output_format)
  File "C:\Users\kobru\AppData\Local\Programs\Python\Python313\Lib\site-packages\easyocr\easyocr.py", line 383, in recognize
    image_list, max_width = get_image_list(h_list, f_list, img_cv_grey, model_height = imgH)
                            ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\kobru\AppData\Local\Programs\Python\Python313\Lib\site-packages\easyocr\utils.py", line 613, in get_image_list
    crop_img,ratio = compute_ratio_and_resize(crop_img,width,height,model_height)
                     ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\kobru\AppData\Local\Programs\Python\Python313\Lib\site-packages\easyocr\utils.py", line 574, in compute_ratio_and_resize
    img = cv2.resize(img,(model_height,int(model_height*ratio)), interpolation=Image.Resampling.LANCZOS)
cv2.error: OpenCV(4.12.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\resize.cpp:4208: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions