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.

IOError for OSD (psm 0)

See original GitHub issue

Running pytesseract on Raspbian, python 2.7, tesseract 4.00 (4.00.00dev-625-g9c2fa0d).

My code is as follows:

ret = image_to_string(im,lang='eng',boxes=False, config="-psm 0")

Error:

Traceback (most recent call last):
  File "/home/pi/Vocable/TESTING.py", line 114, in <module>
    ret = image_to_string(im,lang='eng',boxes=False, config="-psm 0")
  File "/usr/local/lib/python2.7/dist-packages/pytesseract/pytesseract.py", line 126, in image_to_string
    f = open(output_file_name, 'rb')
IOError: [Errno 2] No such file or directory: '/tmp/tess_lN5JlN.txt'

If I run code with psm 1 [Recognition with OSD], I receive no errors but the upside down text is simply treated as right-side-up text, producing garbage results. (This was tested on an inverted test.png)

Essentially text recognition works but OSD does not.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18

github_iconTop GitHub Comments

1reaction
int3lcommented, Nov 18, 2017

@movaid7 I suggest leaving the image_to_string function as it is (logically) - returning text or raising error exception, when there is no txt file. And we can have new function image_to_file - returning list of temp file path strings created by tesseract. (In this case, the user should parse the files manually according to his/her use case)

0reactions
abelsaugcommented, Jul 9, 2018

The orientation parameter is not available with image_to_data, right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error setting psm for pytesseract - Stack Overflow
I'm trying to use a psm of 0 with pytesseract, but I'm getting an error. My code is: import pytesseract from PIL import...
Read more >
How to use the tesserocr.PSM.AUTO_OSD function in ... - Snyk
PSM.AUTO_OSD function in tesserocr. To help you get started, we've selected a few tesserocr examples, based on popular ways it is used in...
Read more >
tesseract - T-Plan Robot Documentation
The OCR makes the calling command return 1 when the OCR throws an error caused by misconfiguration or an I/O error. Text of...
Read more >
pytesseract.py 2019-09-18 02:24 13 KB
STRING, timeout=0): """ Returns string containing the orientation and script detection (OSD) """ config = '{}-psm 0 {}'.format( '' if ...
Read more >
Welcome to ODASD(Product Support) - OUSD A&S
The next PSM Workshop is scheduled to take place September 13-15, 2022 at the General Jacob E. Smart Conference Center on Joint Base...
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