VietOCR

POPIS

VietOCR is a Java GUI frontend for Tesseract OCR engine, providing character recognition support for common image formats, and multi-page images. The program has postprocessing which helps correct errors regularly encountered in the OCR process, boosting the accuracy rate on the result. The program can also function as a console application, executing from the command line.

Podporované je aj dávkové spracovanie. Program monitoruje nové obrázkové súbory v sledovanom priečinku a automaticky ich spracuje pomocou OCR systému a výstup uloží do výstupného priečinka.

SYSTÉMOVÉ POŽIADAVKY

Java Runtime Environment 8 or later. On Windows, Microsoft Visual C++ 2022 Redistributable Package is also required.

INŠTALÁCIA

Tesseract Windows executable is bundled with the program. Additional language data packs for Tesseract, whose names start with ISO639-3 codes, should be placed into the tessdata subdirectory.

V Ubuntu sú Tesseract a jeho jazykové dáta súčasťou Graphics (universe) repository. Môžete ich nainštalovať pomocou Synaptic alebo príkazu:

sudo apt-get install tesseract-ocr tesseract-ocr-eng tesseract-ocr-vie

The files will be placed in /usr/bin and /usr/share/tesseract-ocr/tessdata, respectively. On the other hand, if Tesseract is built and installed from the source, they will be placed in /usr/local/bin and /usr/local/share/tessdata. You can also let VietOCR know the location of tessdata via the environment variable TESSDATA_PREFIX:

export TESSDATA_PREFIX=/usr/local/share/

For other platforms, please consult Tesseract Wiki page.

VietOCR also provides support for downloading and installing selected language packs via Download Language Data menu item. Depending on the location of the tessdata folder, you may be required to run the program as root or admin to be able to install the downloaded data into the folder if it is inside a system folder, such as in /usr on Linux or C:\Program Files on Windows.

Scanning support on Windows is provided via the Windows Image Acquisition Library v2.0.

sudo apt-get install libsane sane sane-utils libsane-extras xsane

sudo apt-get install libsane sane sane-utils libsane-extras xsane

PDF support is possible via PDFBox.

Spellcheck functionality is available through Hunspell, whose dictionary files (.aff, .dic) should be placed in dict folder of VietOCR. user.dic is an UTF-8-encoded file which contains a list of custom words, one word per line.

On Linux, Hunspell and its dictionaries can be installed by Synaptic or apt, as follows:

sudo apt-get install hunspell hunspell-en-us

INŠTRUKCIE

java -jar VietOCR.jar

java -jar VietOCR.jar

Note: If you encounter out-of-memory exception, run ocr script file instead of using the .jar.

The Vietnamese language data were generated for Times New Roman, Arial, Verdana, and Courier New fonts. Therefore, the recognition would have better success rate for images having similar font glyphs. OCRing images that have font glyphs look different from the supported fonts generally will require training Tesseract to create another language data pack specifically for those typefaces. Language data for some VNI and TCVN3 (ABC) fonts have also been bundled in latest versions.

Images to be OCRed should be scanned at resolution from at least 200 DPI (dot per inch) to 400 DPI in monochrome (black&white) or grayscale. Scanning at higher resolutions will not necessarily result in better recognition accuracy, which currently can be higher than 97% for Vietnamese, and the next release of Tesseract may improve it even further. Even so, the actual rates still depend greatly on the quality of the scanned image. The typical settings for scanning are 300 DPI and 1 bpp (bit per pixel) black&white or 8 bpp grayscale uncompressed TIFF or PNG format.

Okrem vstavaného algoritmu pre post-spracovania textu, môžete si pridať vlastnú schému nahradzovania textu textový súbor s názvom x.DangAmbigs.txt, kde x je ISO639-3 kód jazyka. Tento súbor v UTF-8 kódovaní by mal obsahovať páry oddelené znakom „rovná sa“ v tvare staráHodnota=nováHodnota.

In addition to the built-in text postprocessing algorithm, you can add your own custom text replacement scheme via a UTF-8-encoded tab-delimited text file named x.DangAmbigs.txt, where x is the ISO639-3 language code. Both plain and Regex text replacements are supported.

You can put init-only and non-init control parameters in tessdata/configs/tess_configs and tess_configvars files, respectively, to modify Tesseract's behaviour.

Some built-in tools are provided to merge several images or PDF files into a single one for convenient OCR operations, or to split a TIFF or PDF file into smaller ones if it contains too many pages, which can cause out-of-memory exceptions.

Chyby pri rozoznávaní znakov sa dajú rozdeliť do troch kategórií. Časté sú zámeny veľkosti písmen napr. „O“ — „o“, „Z“ — „z“, „S“ — „s“. Tieto chyby sa dajú opraviť pomocou populárnych Unicode textových editorov.

Ďalšie chyby sú spôsobené OCR procesom - napríklad chýbajúce diakritické znamienka, zamenené znaky („1“ — „l“). Takéto chyby je možné pomerne ľahko opraviť pomocou kontroly preklepov (spellechecker). Vstavané funkcie pre post-spracovanie vám môžu pomôcť s vyššie uvedeným chybami.

Poslednou kategóriou sú chyby, ktoré je ťažké detegovať, pretože sú to sémantické chyby, čo znamená, že dané slová sa nachádzajú v slovníku, ale sú chybné z hľadiska kontextu napr. „súd“ — „sud“ a pod. Tieto chyby si vyžadujú, aby ich opravil korektor manuálne podľa originálneho obrázka.

Tu sú inštrukcie, ako opraviť prvé dve kategórie OCR chýb s pomocou zabudovanej funkcie:

  1. Zoskupenie riadkov. Riadky je potrebné zoskupiť tak, aby zodpovedali odsekom, ku ktorým patria (1 odsek = 1 riadok). Použite na to funkciu Odstrániť zalomenia riadkov, ktorá sa nachádza v menu Formát. Takáto operácia nie je potrebná pre básne.
  2. Vyberte Zmeniť veľkosť písmen, z ponuky Formát, a potom Prvé veľké na opravu chýb veľkosti písmen. Následne opravte ostatné chyby veľkosti písmen (napr. mená, názvy).
  3. Opravte preklepy s použitím Kontrola preklepov.

Ak máte nejaké otázky, položte ich na VietOCR fórum.

Ak máte nejaké otázky, položte ich na VietOCR fórum.