I'm using tesseract-ocr-3.01 to scan many forms. The forms all follow a template, so I already know where the regions/rectangles of text are.
Is there a way to pass those regions to tesseract when using the command-line tool?
I'm using tesseract-ocr-3.01 to scan many forms. The forms all follow a template, so I already know where the regions/rectangles of text are.
Is there a way to pass those regions to tesseract when using the command-line tool?
I found the answer, thanks to this thread.
It seems that tesseract suports the uzn format (used in the unvl tests).
From the thread:
Calling tesseract with parameter "-psm 4" and renaming the uzn file with the same name of the image seem works.
Example: If we have C:\input.tif
and C:\input.uzn
, we do this:
tesseract -psm 4 C:\input.tif C:\output
This may not be an optimal answer, but here goes:
I'm not sure whether the command-line tool has options to specify text-regions.
What you can do is use a Tesseract wrapper on another platform (EmguCV has Tesseract built-in). So you get the the scanned image, crop out the text-regions, and give them to Tesseract one-at-a-time. This way you'll also avoid any inaccuracies in Tesseract's page-layout analysis.
eg.
Image<Gray,Byte> scannedImage = new Image<Gray,Byte>(path_to_scanned_image);
//assuming you know a text region
Image<Gray,Byte> textRegion = new Image(100,20);
scannedImage.ROI = new Rectangle(0,0,100,20);
scannedImage.copyTo(textRegion);
ocr.recognize(textRegion);