Tesseract.exe from command line defaults Page Segmentation Mode to 3 while 
from API it defaults to 6.  PSM of 3 yields much better results for the 
type of documents I'm processing but changing to PSM 3 causes API 
function TessBaseAPIRecognize to freeze program execution.

Is anyone changing PSM to 3 or 1 from API while successfully executing API 
Recognize later down the road?

Here is what my code looks like:

   handle := TessBaseAPICreate() 

   IF TessBaseAPIInit3( handle, NIL, "eng" ) == 0     //abort if english 
traindata file can't be found

            //change PSM to 3 =Fully automatic Page Seg but no OSD.
            TessBaseAPISetPageSegMode( handle, 3 ) 

            img := pixRead( ALLTRIM( cPath )+cFile )

            TessBaseAPISetImage2( handle, img )

            //program execution freezes right when calling next line
            //but only when PageSegMode is set to 3.  If I comment line 
above 
            //where PageSegMode is set to 3 then program execution flows 
            //without freezing on the next line.
            IF TessBaseAPIRecognize( handle, Nil ) <> 0  ; LOOP   ;ENDIF

            cText := TessBaseAPIGetUTF8Text( handle )
....


Please help, thank you.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/70acaa8e-ce69-421f-8c9c-625a64bc3854%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to