question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

readtext doesn't work with latest opencv version

See original GitHub issue

Windows 10 64bit easyocr 1.4.1 opencv-python 4.5.5.62

Problem

When using reader.readtext I was getting an error message from opencv

\lib\site-packages\easyocr\craft_utils.py", line 31, in getDetBoxes_core
    nLabels, labels, stats, centroids = cv2.connectedComponentsWithStats(text_score_comb.astype(np.uint8), connectivity=4)
cv2.error: Unknown C++ exception from OpenCV code

Solution

Spent most of my day trying to fix whatever was wrong with connectedComponentsWithStats… Issue didn’t go away no matter what I did until I switched from opencv-python version 4.5.5.62 to version 4.5.4.60 .

I know this is a opencv problem so you can’t do much about, but probably should limit the opencv version until they fix

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:22
  • Comments:5

github_iconTop GitHub Comments

4reactions
JafirDoncommented, Jan 17, 2022

Hi, Please change the opencv-python version to 4.5.4.60. Try this command,

!pip uninstall opencv-python
!pip install opencv-python==4.5.4.60 easyocr

then, you will use readtext thank you

1reaction
varunsingh3000commented, Dec 30, 2021

Just followed the above solution by @SHA65536 and now readtext is working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unknown OpenCV exception while using EasyOcr
The new version of OpenCV has some issues. Uninstall the newer version of OpenCV and install the older one using:
Read more >
OpenCV Text Detection (EAST text detector) - PyImageSearch
In this tutorial you will learn how to use OpenCV to detect text in natural scene images using the EAST text detector.
Read more >
How to Extract Text from Images in Python using ... - YouTube
First released in 2007, PyTesseract is the to-go library for extracting text from images. It uses classical computer vision methods to ...
Read more >
Text Detection with OpenCV in Python | OCR using Tesseract ...
In this video, we are going to learn how to detect text in images. We will learn how to detect individual characters and...
Read more >
easyocr - PyPI
9 April 2022 - Version 1.4.2. Update dependencies (opencv and pillow issues). 11 September 2021 - Version 1.4.1. Add trainer folder; Add readtextlang...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found