Tesseract: Specifying regions of text

前端 未结 2 836
面向向阳花
面向向阳花 2020-12-14 22:13

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

相关标签:
2条回答
  • 2020-12-14 22:42

    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
    
    0 讨论(0)
  • 2020-12-14 22:50

    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); 
    
    0 讨论(0)
提交回复
热议问题