frame_decoration
original (2019/05/14 付) Google 翻訳 (2019/05/23 付)
# Improving the quality of the output #出力品質の向上
There are a variety of reasons you might not get good quality output from Tesseract. It's important to note that, unless you're using a very unusual font or a new language, retraining Tesseract is unlikely to help. あなたがTesseractから良い品質の出力を得られないかもしれない様々な理由があります。非常に珍しいフォントや新しい言語を使用しているのでない限り、Tesseractを再トレーニングしても助けになる可能性は低いことに注意することが重要です。
* Image processing * 画像処理
* Rescaling * 再調整
* Binarisation * 2値化
* Noise Removal * ノイズ除去
* Rotation / Deskewing * [回転/傾き補正](#回転 - 傾き補正)
* Borders * 罫線
* Transparency / Alpha channel * [透明度/アルファチャンネル](#透明度 - アルファチャンネル)
* Tools / Libraries * [ツール/ライブラリ](#tools - ライブラリ)
* Examples *
* Page segmentation method * ページ分割方法
* Dictionaries, word lists, and patterns * 辞書、単語リスト、およびパターン
* Still having problems? * まだ問題がありますか?
## Image processing ## 画像処理
Tesseract does various image processing operations internally (using the Leptonica library) before doing the actual OCR. It generally does a very good job of this, but there will inevitably be cases where it isn't good enough, which can result in a significant reduction in accuracy. Tesseractは実際のOCRをする前に内部的に(Leptonicaライブラリを使って)様々な画像処理操作を行います。それは一般にこれの非常によい仕事をします、しかし、それが十分に良くない場合は必然的にあるでしょう、そしてそれは正確さのかなりの減少をもたらすことができます。
You can see how Tesseract has processed the image by using the configuration variable tessedit_write_images to true (or using configfile get.images) when running Tesseract. If the resulting tessinput.tif file looks problematic, try some of these image processing operations before passing the image to Tesseract. Tesseractの実行時に設定変数tessedit_write_imagestrueに(またはconfigfileの get.imagesを使って)使うことでTesseractがどのように画像を処理したかを見ることができます。結果の tessinput.tifファイルに問題があると思われる場合は、Tesseractに画像を渡す前にこれらの画像処理操作のいくつかを試してみてください。
### Inverting images ###反転画像
While tesseract version 3.05 (and older) handle inverted image (dark background and light text) without problem, for 4.x version use dark text on light background. tesseractバージョン3.05(およびそれ以前)は反転画像(暗い背景と明るいテキスト)を問題なく処理しますが、4.xバージョンでは明るい背景に暗いテキストを使用します。
### Rescaling ###再スケーリング
Tesseract works best on images which have a DPI of at least 300 dpi, so it may be beneficial to resize images. For more information see the FAQ. Tesseractは、少なくとも300 dpiのDPIを持つ画像に最適です。そのため、画像のサイズを変更すると効果的です。詳細については[FAQ]を参照してください(FAQ-Old#は最小のテキストサイズで、画面のテキストが読めない)。
"Willus Dotkom" made interesting test for Optimal image resolution with suggestion for optimal Height of capital letter in pixels. 「Willus Dotkom」は、最適な画像の解像度について、ピクセル単位の最適な大文字の高さを提案して、興味深いテストを行いました。
### Binarisation ###二値化
binarisation.png binarisation.png
This is converting an image to black and white. Tesseract does this internally (Otsu algorithm), but the result can be suboptimal, particularly if the page background is of uneven darkness. これは画像を白黒に変換しています。 Tesseractはこれを内部的に行います(Otsuアルゴリズム)が、特にページの背景が不均一な暗さの場合には、結果は最適とは言えません。
If you are not able to fix by better input image, you can try different algorithm. See ImageJ Auto Threshold (java) or OpenCV Image Thresholding (python) or scikit-image Thresholding documentation (python). あなたがより良い入力画像で修正することができない場合は、別のアルゴリズムを試すことができます。 ImageJ自動しきい値(java)またはOpenCV画像しきい値(python)を参照してください。またはscikit-image Thresholdingドキュメント(python)。
### Noise Removal ###ノイズ除去
noise.png noise.png
Noise is random variation of brightness or colour in an image, that can make the text of the image more difficult to read. Certain types of noise cannot be removed by Tesseract in the binarisation step, which can cause accuracy rates to drop. ノイズは、画像内の明るさや色のランダムな変動で、画像のテキストを読みにくくすることがあります。バイナリ化ステップでTesseractで特定の種類のノイズを除去することはできません。これにより、正解率が低下する可能性があります。
### Rotation / Deskewing ###回転/傾き補正
skew-linedetection.png skew-linedetection.png
A skewed image is when a page has been scanned when not straight. The quality of Tesseract's line segmentation reduces significantly if a page is too skewed, which severely impacts the quality of the OCR. To address this rotate the page image so that the text lines are horizontal. 画像が傾いていると、ページがまっすぐでないときにスキャンされたときに発生します。ページが歪んでいると、Tesseractのラインセグメンテーションの品質が大幅に低下します。これはOCRの品質に深刻な影響を与えます。これに対処するには、テキスト行が水平になるようにページ画像を回転させます。
### Borders ###ボーダーズ
#### Scanning border Removal ####スキャニングボーダー除去
borders.png borders.png
Scanned pages often have dark borders around them. These can be erroneously picked up as extra characters, especially if they vary in shape and gradation. スキャンされたページは、その周囲に暗い縁があることがあります。特に形やグラデーションが異なる場合、これらは誤って余分な文字として認識される可能性があります。
#### Missing borders ####境界線がありません
If you OCR just text area without any border, tesseract could have problems with it. See for some details in tesseract user forum#427 . You can easy add small border (e.g. 10 pt) with ImageMagick®: 境界のないテキスト領域だけをOCRすると、tesseractに問題が生じる可能性があります。 [tesseractユーザーフォーラム](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/tesseract-ocr/v26a -RYPSOE / 2Sppq61GBwAJ)[https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg] [https: //github.com/tesseract-ocr/tesseract/issues/427)あなたは簡単にImageMagick®で小さいボーダー(例えば10 pt)を追加することができます。
` | `
convert 427-1.jpg -bordercolor White -border 10x10 427-1b.jpg 変換427-1.jpg - ボーダーカラーホワイト - ボーダー10x10 427-1b.jpg
` | `
### Transparency / Alpha channel ###透明度/アルファチャンネル
Some image formats (e.g. png) can have alpha-channel for providing transparency feature. いくつかの画像フォーマット(例えば、png)は、透明度機能を提供するためにアルファチャンネルを有することができる。
Tesseract 3.0x expects that users remove alpha channel from image before using image in tesseract. This can done e.g. with ImageMagick command: Tesseract 3.0xはユーザーがtesseractで画像を使用する前に画像からアルファチャンネルを削除することを期待しています。これはできます。 ImageMagickコマンドで:
` | `
convert input.png -alpha off output.png input.pngを変換します。alphaoff output.png
` | `
Tesseract 4.00 removes alpha channel with leptonica function pixRemoveAlpha(): it removes alpha component by blending with white background. In some case (e.g. OCR of movie subtitles) this can lead to problems, so users would need to remove alpha channel (or pre-process image by inverting image colors) by themself. Tesseract 4.00はレプトニカ関数でアルファチャンネルを削除しますpixRemoveAlpha()アルファ線を削除してアルファコンポーネントを削除します。場合によっては(たとえば、[映画の字幕]のOCR(https://github.com/tesseract-ocr/tesseract/issues/2048#issuecomment-438015376))、問題が発生する可能性があるため、ユーザーはアルファチャンネルを削除する必要があります(または画像の色を反転させて画像を前処理します
### Tools / Libraries ###ツール/ライブラリ
* Leptonica * レプトニカ
* OpenCV * OpenCV
* ScanTailor Advanced * ScanTailor Advanced
* ImageMagick * ImageMagick
* unpaper * unpaper
* ImageJ * ImageJ
* Gimp * Gimp
* PRLib - Pre-Recognize Library with algorithms for improving OCR quality * PRLib - OCR品質を向上させるためのアルゴリズムを使用したライブラリの事前認識
### Examples ###例
If you need an example how to improve image quality programmatically, have a look at this examples: プログラムで画質を向上させる方法の例が必要な場合は、次の例を見てください。
* OpenCV - Rotation (Deskewing) - c++ example * [OpenCV - 回転(傾き補正)](http://felix.abecassis.me/2011/10/opencv-rotation- deskewing /) - c ++の例
* Fred's ImageMagick TEXTCLEANER - bash script for processing a scanned document of text to clean the text background. * FredのImageMagick TEXTCLEANER - テキストの背景をきれいにするためにスキャンしたテキストを処理するためのbashスクリプト。
* rotation_spacing.py - python script for automatic detection of rotation and line spacing of an image of text * rotation \ _spacing.py - テキストの画像の回転と行間の自動検出のためのpythonスクリプト
* crop_morphology.py - Finding blocks of text in an image using Python, OpenCV and numpy * [crop \ _morphology.py](https://github.com/danvk/oldnyc / blob / master /ocr / tess / crop_morphology.py) - [Python、OpenCV、およびnumpyを使用して画像内のテキストブロックを見つけるhttp://www.danvk.org/2015/01/07/finding-blocks-of-text-in-an-image-using-python-opencv-and-numpy.html)
* Credit card OCR with OpenCV and Python * OpenCVとPythonのクレジットカードOCR
* noteshrink - python example how to clean up scans. Details in blog Compressing and enhancing hand-written notes. * noteshrink - Pythonのスキャン方法の例。詳細はブログ手書きノートの圧縮と拡張にあります。
* uproject text - python example how to recover perspective of image. Details in blog Unprojecting text with ellipses. * uproject text - pythonの例で画像の見方を回復します。詳細はブログ省略記号付きのテキストの投影解除をご覧ください。
* page_dewarp - python example for Text page dewarping using a "cubic sheet" model. Details in blog Page dewarping. * page_dewarp - "キュービックシート"モデルを使ったテキストページの歪み補正のpythonの例。詳細はブログPage dewarpingにあります。
## Page segmentation method ##ページ分割方法
By default Tesseract expects a page of text when it segments an image. If you're just seeking to OCR a small region try a different segmentation mode, using the --psm argument. Note that adding a white border to text which is too tightly cropped may also help, see issue 398. デフォルトでは、Tesseractは画像を分割するときに1ページのテキストを期待します。小さな領域をOCRにしたいだけなら、 --psm引数を使って別のセグメンテーションモードを試してください。細く切り取られているテキストに白い枠線を追加すると効果的な場合があります。issue 398 -ocr / issues / detail?id = 398)
To see a complete list of supported page segmentation modes, use tesseract -h. Here's the list as of 3.21: サポートされているページセグメンテーションモードの完全なリストを見るには tesseract -hを使ってください。これは3.21の時点でのリストです:
` | `
0 Orientation and script detection (OSD) only. 0方向と文字検出(OSD)のみ。
1 Automatic page segmentation with OSD. 1 OSDによる自動ページセグメンテーション。
2 Automatic page segmentation, but no OSD, or OCR. 2自動ページ分割。ただし、OSD、またはOCRはありません。
3 Fully automatic page segmentation, but no OSD. (Default) 3全自動ページセグメンテーション、OSDなし。 (デフォルト)
4 Assume a single column of text of variable sizes. 4可変サイズのテキストの1列を想定します。
5 Assume a single uniform block of vertically aligned text. 5垂直方向に配置されたテキストの単一の均一なブロックを仮定します。
6 Assume a single uniform block of text. 6一様なテキストブロックを仮定する。
7 Treat the image as a single text line. 7画像を1行のテキストとして扱います。
8 Treat the image as a single word. 8画像を一語として扱います。
9 Treat the image as a single word in a circle. 9画像を円の中の1単語として扱います。
10 Treat the image as a single character. 10画像を1文字として扱います。
11 Sparse text. Find as much text as possible in no particular order. 11スパーステキスト。特定の順序でできるだけ多くのテキストを見つけます。
12 Sparse text with OSD. 12 OSD付きのまばらなテキスト。
13 Raw line. Treat the image as a single text line, 13行。画像を1行のテキストとして扱う
` | `
## Dictionaries, word lists, and patterns ##辞書、単語リスト、そしてパターン
By default Tesseract is optimized to recognize sentences of words. If you're trying to recognize something else, like receipts, price lists, or codes, there are a few things you can do to improve the accuracy of your results, as well as double-checking that the appropriate segmentation method is selected. デフォルトでは、Tesseractは単語の文章を認識するように最適化されています。領収書、価格表、コードなど、他のものを認識しようとしている場合は、結果の精度を向上させるためにできることがいくつかあります。また、適切なsegmentation methodを確認します。ページ分割方法)が選択されています。
Disabling the dictionaries Tesseract uses should increase recognition if most of your text isn't dictionary words. They can be disabled by setting both of the configuration variables load_system_dawg and load_freq_dawg to false. Tesseractが使用する辞書を無効にすると、テキストの大部分が辞書の単語ではない場合、認識が向上します。それらは設定変数load_system_dawgload_freq_dawgの両方を falseに設定することで無効にできます。
It is also possible to add words to the word list Tesseract uses to help recognition, or to add common character patterns, which can further help to improve accuracy if you have a good idea of the sort of input you expect. This is explained in more detail in the Tesseract manual. 認識を助けるためにTesseractが使用する単語リストに単語を追加したり、一般的な文字パターンを追加することも可能です。これはTesseractマニュアルでより詳しく説明されています-データ)。
If you know you will only encounter a subset of the characters available in the language, such as only digits, you can use the tessedit_char_whitelist configuration variable. See the FAQ for an example. Note this feature is not supported in Tesseract 4. See here for a workaround. 数字だけのように、言語で利用可能な文字のサブセットのみに出会うことがわかっているなら、 tessedit_char_whitelist 設定変数を使うことができます。 例についてのFAQを参照してください。この機能はTesseract 4ではサポートされていません。回避策については[ここ](issues / 751#issuecomment-333904808)を参照してください。
## Still having problems? ##まだ問題がありますか?
If you've tried the above and are still getting low accuracy results, ask on the forum for help, ideally posting an example image. 上記の方法を試しても精度が低い結果が得られる場合は、フォーラムで質問する、理想的にはサンプル画像
最終更新:2019年08月19日 20:49