-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Open
Labels
OSDOrientation and Script DetectionOrientation and Script Detection
Description
Current Behavior
Latest Tesseract 5.3.1 has a bug in DetectOrientationScript() that causes it to randomly fail when attempting to detect image orientation for 90 degree image scans. The problem is that getting a script id can return -1 which then indexes into a "done" array
On my system this fails about 20% of the time on the exact same image input
Error found with valgrind
Expected Behavior
Trivial fix to not write to done[-1] which then allows DetectOrientationScript() to always return the same results
Suggested Fix
--- src/ccmain/osdetect.cpp.org 2023-04-26 16:26:18.618274574 -0700
+++ src/ccmain/osdetect.cpp 2023-04-26 16:54:37.041375058 -0700
@@ -488,10 +488,12 @@
}
}
// Script already processed before.
- if (done[id]) {
- continue;
+ if (id != -1) {
+ if (done[id]) {
+ continue;
+ }
+ done[id] = true;
}
- done[id] = true;
unichar = tess_->unicharset.id_to_unichar(choice->unichar_id());
tesseract -v
No response
Operating System
RHEL 8
Other Operating System
No response
uname -a
No response
Compiler
gcc 12.2
CPU
No response
Virtualization / Containers
No response
Other Information
No response
Metadata
Metadata
Assignees
Labels
OSDOrientation and Script DetectionOrientation and Script Detection