TIKA-2696 Add support for OSD output, contributed by @4U6U57 - #246
TIKA-2696 Add support for OSD output, contributed by @4U6U57#2464U6U57 wants to merge 3 commits into
Conversation
tballison
left a comment
There was a problem hiding this comment.
Thank you for opening this PR. Would you be able to include a unit test?
New testOCR_osd.jpg file is converted copy of existing testPDF.pdf
|
@tballison Added test. |
|
Hi @tballison , can you please re-review after the tests were added? |
|
Sorry for my delay. Three things.
This is what I see with an old version of Tesseract: |
|
And from the Windows build that is hot off the press (the June 2018 beta version threw an exception with -psm 0). tesseract v4.0.0-rc1.20181008 Page number: 0 |
OSD Output Testing[avalera:~/test]
$ ls
test.jpg
[avalera:~/test]
$ tesseract test.jpg stdout --psm 0 -l osd
Warning. Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 227
Page number: 0
Orientation in degrees: 0
Rotate: 0
Orientation confidence: 16.99
Script: Latin
Script confidence: 0.16
[avalera:~/test]
$ tesseract test.jpg stdout --psm 0 -l osd 2>/dev/null
Page number: 0
Orientation in degrees: 0
Rotate: 0
Orientation confidence: 16.99
Script: Latin
Script confidence: 0.16
[avalera:~/test]
$ tesseract test.jpg stdout --psm 1
Warning. Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 227
CHAPTER 5
IN THE MIDDLE OF THE NIGHT
Tue next day Aunt Hetty took Pam and Peter and
their cousin Brock in the pony-cart to the sea,
which was about three miles away. This was such
fun that the three children forgot all about Cliff
Castle for a day or two. And then something hap-
pened that reminded them of it.
It was something that happened in the middle
of the night. Pam woke up and felt very thirsty.
She remembered that Aunt Hetty had left a jug
of water and a tumbler on the mantelpiece and
she got up to get it.
She stood at the window, drinking the water. It
39
[avalera:~/test]
$ ls
test.jpg
[avalera:~/test]
$ tesseract test.jpg outfile --psm 0 -l osd
Tesseract Open Source OCR Engine v4.0.0-beta.1 with Leptonica
Warning. Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 227
[avalera:~/test]
$ ls
outfile.osd test.jpg
[avalera:~/test]
$ rm outfile.osd
[avalera:~/test]
$ tesseract test.jpg outfile --psm 1
Tesseract Open Source OCR Engine v4.0.0-beta.1 with Leptonica
Warning. Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 227
[avalera:~/test]
$ ls
outfile.txt test.jpg
|
|
Is there any chance of someone completing this fix? |
|
I've made the fix in 2.1.1-SNAPSHOT. Please give it a try and make sure it behaves as desired. |
|
Will do. Where can I get this version? |
|
I have verified the fix. It works very nicely. Thanks a lot! |
|
Thank you for the confirmation! |
|
Hello, I am currently using the Tika 2.9.1 server version and need the output of the OSD in my metadata, particularly the value of the script (Latin, Cyrillic, etc.). So my questions are the following: |
|
This is a closed issue from years ago, please ask this in the user's mailing list (don't forget to subscribe) or on stackoverflow.com. |
See https://issues.apache.org/jira/browse/TIKA-2696
Contributed by @4U6U57 on behalf of @egnyte