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.

error when reading an png

See original GitHub issue
Traceback (most recent call last):
  File "testocr.py", line 5, in <module>
    result = reader.readtext('1.png')
  File "C:\Users\karl\Desktop\test\venv\lib\site-packages\easyocr\easyocr.py", line 385, in readtext
    horizontal_list, free_list = self.detect(img, min_size, text_threshold,\
  File "C:\Users\karl\Desktop\test\venv\lib\site-packages\easyocr\easyocr.py", line 275, in detect
    text_box_list = get_textbox(self.detector, img, canvas_size, mag_ratio,
  File "C:\Users\karl\Desktop\test\venv\lib\site-packages\easyocr\detection.py", line 95, in get_textbox
    bboxes_list, polys_list = test_net(canvas_size, mag_ratio, detector,
  File "C:\Users\karl\Desktop\test\venv\lib\site-packages\easyocr\detection.py", line 55, in test_net
    boxes, polys, mapper = getDetBoxes(
  File "C:\Users\karl\Desktop\test\venv\lib\site-packages\easyocr\craft_utils.py", line 236, in getDetBoxes
    boxes, labels, mapper = getDetBoxes_core(textmap, linkmap, text_threshold, link_threshold, low_text, estimate_num_chars)
  File "C:\Users\karl\Desktop\test\venv\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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

7reactions
Aslyamovtcommented, Jan 11, 2022

@MicalKarl solved this problem by opencv-python-headless и opencv-python of version 4.5.1.48

1reaction
egerescommented, Feb 9, 2022

I was getting the same issue (which hadn’t happened before, I have no idea how this broke out of nowhere)

Fixed it with the pip install opencv-python-headless==4.5.1.48 @Aslyamovt mentioned and was changed in https://github.com/xuyichenmo/EasyOCR/commit/3333f241349ddaf45477cc1bcda768da56d338dd

Read more comments on GitHub >

github_iconTop Results From Across the Web

exception: I/O error reading PNG header! for image reading size
PS: Checked the source code PNGImageReader , and it seems that the PNG is corrupted. You should get more info from the stack...
Read more >
Fatal error reading PNG image file: Not a PNG file - Reddit
r/pop_os - Fatal error reading PNG image file: Not a PNG file ... The png file is corrupted and unreadable.
Read more >
Error reading PNG image data - Usage & Issues
Hello everyone, I created an ImageJ macro for enhancing the histrogram of all “raw” images in a directory and saving the enhanced images ......
Read more >
14 I/O error reading PNG header - Tess4J - SourceForge
It works fine if I give JPG or BMP image as a input. But it is showing error while reading the PNG format...
Read more >
Error when trying to view .png files: "windows photo viewer
a. Right click on .png file of the picture and select Open With and click Change Default program. b.
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