Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orientation Angle is Incorrect (180 instead of 0) #4172

Open
wvanrensburg opened this issue Dec 21, 2023 · 3 comments
Open

Orientation Angle is Incorrect (180 instead of 0) #4172

wvanrensburg opened this issue Dec 21, 2023 · 3 comments
Labels
OSD Orientation and Script Detection

Comments

@wvanrensburg
Copy link

Current Behavior

Trying to get the orientation of an image using psm 0, and it's reporting an incorrect orientation angle.

Commands Tried:

tesseract /path/to/image.png /pah/to/reportout --psm 0
tesseract /path/to/image.png /pah/to/reportout --psm 0 --oem 0
tesseract /path/to/image.png /pah/to/reportout --psm 0 --oem 1
tesseract /path/to/image.png /pah/to/reportout --psm 0 --oem 3

Output of the osd result:

Page number: 0
Orientation in degrees: 180
Rotate: 180
Orientation confidence: 1.45
Script: Greek
Script confidence: 0.59

Image being used:
download

Expected Behavior

The result should spit out a rotation of zero..

Page number: 0
Orientation in degrees: 0
Rotate: 0
...

Suggested Fix

N/A

tesseract -v

tesseract 5.3.3
 leptonica-1.83.1
  libgif 5.2.1 : libjpeg 8d (libjpeg-turbo 3.0.0) : libpng 1.6.40 : libtiff 4.6.0 : zlib 1.2.11 : libwebp 1.3.2 : libopenjp2 2.5.0
 Found SSE4.1
 Found libarchive 3.7.2 zlib/1.2.11 liblzma/5.4.4 bz2lib/1.0.8 liblz4/1.9.4 libzstd/1.5.5
 Found libcurl/7.85.0 SecureTransport (LibreSSL/3.3.6) zlib/1.2.11 nghttp2/1.47.0

Operating System

macOS 13 Ventura

Other Operating System

No response

uname -a

No response

Compiler

No response

CPU

No response

Virtualization / Containers

No response

Other Information

No response

@wvanrensburg
Copy link
Author

I figured a work around, which means Im suspecting the tesseract orientation code isn't using enough characters to determine the correct orientation. Adding -c min_characters_to_try=200 produces the correct results..

tesseract /path/to/image.png /pah/to/reportout --psm 0 --oem 0 -c min_characters_to_try=200

Page number: 0
Orientation in degrees: 0
Rotate: 0
Orientation confidence: 3.59
Script: Latin
Script confidence: 0.57

@amitdo amitdo added the OSD Orientation and Script Detection label Dec 24, 2023
@amitdo
Copy link
Collaborator

amitdo commented Dec 25, 2023

If you know in advance that the text is written in a specific language, like English in this case, another thing you can try is to add the parameter -l eng.

I didn't test this on the attached image.

@zdenop
Copy link
Contributor

zdenop commented Jan 13, 2024

tesseract i4172.png - --psm 0
Page number: 0
Orientation in degrees: 180
Rotate: 180
Orientation confidence: 1.45
Script: Greek
Script confidence: 0.59

and with specifying lang:

tesseract i4172.png - --psm 0 -l eng
Warning, detects only orientation with -l eng
Page number: 0
Orientation in degrees: 0
Rotate: 0
Orientation confidence: 25.67
Script: Latin
Script confidence: 5.48
tesseract i4172.png - --psm 0 -l osd
Page number: 0
Orientation in degrees: 180
Rotate: 180
Orientation confidence: 1.45
Script: Greek
Script confidence: 0.59
tesseract i4172.png - --psm 0 -l osd+eng
Warning, detects only orientation with -l osd+eng
Page number: 0
Orientation in degrees: 180
Rotate: 180
Orientation confidence: 1.45
Script: Greek
Script confidence: 0.59
tesseract i4172.png - --psm 0 -l eng+osd
Warning, detects only orientation with -l eng+osd
Page number: 0
Orientation in degrees: 0
Rotate: 0
Orientation confidence: 25.67
Script: Latin
Script confidence: 5.48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OSD Orientation and Script Detection
Projects
None yet
Development

No branches or pull requests

3 participants