Multiple tifs script

31 views
Skip to first unread message

Stathis L.

unread,
Jul 20, 2015, 2:55:43 AM7/20/15
to tesser...@googlegroups.com
Does anyone know how to make a script so that tesseract could process many files and output an hocr file for each tif given? Windows script or linux script would do:) Thanks

ShreeDevi Kumar

unread,
Jul 20, 2015, 3:26:25 AM7/20/15
to tesser...@googlegroups.com
You can setup a loop to read all files and then process each file for HOCR output. 


Here is an example script - this one was for PDF output. You can change output option to hocr - see https://tesseract-ocr.googlecode.com/git/doc/tesseract.1.html for command syntax


#Page Segmentation Modes
#3 = Fully automatic page segmentation, but no OSD. (Default)
#4 = Assume a single column of text of variable sizes.
#6 = Assume a single uniform block of text.
PSM=3
MYFILE=page
LANG=san
OUTPUTOPTION=pdf

rm zzz.txt
for f in *$MYFILE*.tif
do
  echo "Starting OCR for $f file with -l $LANG at $(date) , please wait..."
  tesseract  --tessdata-dir C:/Home/UserShree/tesseract-ocr/testing   $f $f-san  -l $LANG   -psm $PSM $OUTPUTOPTION 
  cat  $f.txt>>zzz.txt
done
echo "OCR done"

gswin32c -dPDFA -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sProcessColorModel=DeviceCMYK  -sPDFACompatibilityPolicy=2 -sOutputFile=zzz.pdf *$MYFILE*-san.pdf 
echo "pdf merged"



ShreeDevi
____________________________________________________________
भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com

On Mon, Jul 20, 2015 at 12:25 PM, Stathis L. <doombri...@gmail.com> wrote:
Does anyone know how to make a script so that tesseract could process many files and output an hocr file for each tif given? Windows script or linux script would do:) Thanks

--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at http://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/2b7f4306-cc23-4cba-90e8-c447f8d08509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages