Closed GoogleCodeExporter closed 9 years ago
I am not sure what it is "-psd option", but this is wrong approach. Library
should not print OCR information to stdout (only debug information).
If you need OSD information you have to use tesseract-ocr API[1] and
modify/patch tesseractmain.cpp.
[1]
https://code.google.com/p/tesseract-ocr/wiki/APIExample#Orientation_and_script_d
etection_(OSD)_example
Original comment by zde...@gmail.com
on 28 Jul 2013 at 9:22
@zdenko: thanks.
About -psd: you're right, it is -psm in current 3.02.02; probably psd in
earlier versions.
Well, what about classifying OSD output as debug output and print it to
stderr/stdout? I understand about the API option but that wouldn't be feasible
for bash scripts, manipulation using executables that can't call the C API etc.
Alternatively, and perhaps much more constructively, it might be better to
include some C++ example programs in source code (and have it compiled when
running make) that demonstrate the Tesseract API, e.g. something like the
attached file - note: I'm not a C++ programmer at all, it doesn't even compile,
but I hope you get the drift.
Original comment by reiniero...@gmail.com
on 29 Jul 2013 at 8:22
Attachments:
"Well, what about classifying OSD output as debug output and print it to
stderr/stdout"
=> Why to pretend it is debug output? Did your bash script is able use
tesseract-ocr library? I don't think so. I guess you use tesseract-ocr
executable. So tesseract-ocr executable should be improved.
Best example code is tesseract-ocr executable(api/tesseractmain.cpp). It did
everything you asked about example ;-)
Your tessinfo.cxx could be compiled easily (I try it on openSUSE 12.3):
g++ -o tessinfo tessinfo.cxx -ltesseract
Original comment by zde...@gmail.com
on 31 Jul 2013 at 9:03
"Did your bash script is able use tesseract-ocr library? I don't think so. I
guess you use tesseract-ocr executable. So tesseract-ocr executable should be
improved." Completely right! Perhaps I misunderstood what you were saying.
Thanks a lot for the info as well as the compile (fails here with leptonica lib
errors but I'll probably need to give it a go on a stable system).
Original comment by reiniero...@gmail.com
on 31 Jul 2013 at 10:35
Ok. Changing tesseract executable should not be a big issue. If there will be
time I will have a look on it if somebody else will not send a patch ;-!
Original comment by zde...@gmail.com
on 3 Aug 2013 at 1:49
Hi!
I tried the patch by ogerman, quoted in the first post. It actually works, when
running tesseract with -psm 0 the output is
Tesseract Open Source OCR Engine v3.02.03 with Leptonica
orientation 2
Error during processing.
So the orientation is shown, and that is all I need to know. Using -psm 1 works
flawlessly, but I don't need the text produced, since I want to use this in a
skript for xsane.
What could cause the error using -psm 0?
Original comment by hanksch...@googlemail.com
on 19 Sep 2013 at 6:27
fixed in r982
Original comment by zde...@gmail.com
on 12 Jan 2014 at 2:47
Hi!
Sorry to reopen this, but I can't get any information using the -psm 0 option
with these changes. Using it with the tesseract executable leads no result
whatsoever.
I tried this command:
tesseract image.png stdout --tessdata-dir /usr/share/tesseract-ocr/tessdata
-psm 0 -l deu
With the "simple" patch from the first post (see above) I was able to elicit at
least something like
orientation 2
Is there a way to include that function to the executable without using any API
stuff?
Original comment by hanksch...@googlemail.com
on 1 Feb 2014 at 10:50
that "simple" patch is simple wrong patch ;-)
-psm 0 fixed in r1037.
BTW: -psm 2 provides also information. And I found out that:
tesseract korean.png - -psm 0 -l kor
provides different information than
tesseract korean.png - -psm 0
Original comment by zde...@gmail.com
on 1 Feb 2014 at 1:00
Hi!
With regards to the "simple" patch: Wrong or not, at least it worked ;-)
And you're right about -psm 2, even though I thought (from reading the help)
"2 = Automatic page segmentation, but no OSD, or OCR"
would not perform OSD...
I'll try r1037 asap, thx!
Original comment by hanksch...@googlemail.com
on 1 Feb 2014 at 2:54
Problem was that usage psm 0 (PSM_OSD_ONLY) for AnalyseLayout produces NULL
PageIterator and this was the reason why there was not output...
But with -psm 2 (PSM_AUTO_ONLY) AnalyseLayout produce results... So description
"Automatic page segmentation, but no OSD" could maybe misleading - because
there is no information about script, but there are information about
Orientation, WritingDirection, TextlineOrder and Deskew angle. Somebody could
understand them as part of OSD.
Anyway not you can you psm 0 and 2 to get extra information.
Original comment by zde...@gmail.com
on 1 Feb 2014 at 3:22
OK, checked r1037 out, and now I get information using -psm 0.
btw: it seems that the -psm 2 information with regards to "orientation" is
different to the one provides by -psm 0. Using -psm 2 "WritingDirection" seems
to show the direction of the characters, orientation stays 0, regardless of the
orientation I scan a page.
Original comment by hanksch...@googlemail.com
on 1 Feb 2014 at 6:14
Original issue reported on code.google.com by
reiniero...@gmail.com
on 18 Jul 2013 at 3:14