OCRTesseract クラスは C++ における tesseract-ocr API (v3.02.02) とのインターフェースを提供する。続き...
#include <opencv2/text/ocr.hpp>
|
| String | run (InputArray image, InputArray mask, int min_confidence, int component_level=0) |
| |
| String | run (InputArray image, int min_confidence, int component_level=0) |
| |
| virtual void | run (Mat &image, Mat &mask, std::string &output_text, std::vector< Rect > *component_rects=NULL, std::vector< std::string > *component_texts=NULL, std::vector< float > *component_confidences=NULL, int component_level=0) CV_OVERRIDE |
| |
| virtual void | run (Mat &image, std::string &output_text, std::vector< Rect > *component_rects=NULL, std::vector< std::string > *component_texts=NULL, std::vector< float > *component_confidences=NULL, int component_level=0) CV_OVERRIDE |
| | tesseract-ocr API を使用してテキストを認識する。
|
| |
| virtual void | setWhiteList (const String &char_whitelist)=0 |
| |
| virtual | ~BaseOCR () |
| |
OCRTesseract クラスは C++ における tesseract-ocr API (v3.02.02) とのインターフェースを提供する。
これは tesseract-ocr が正しくインストールされている場合にのみコンパイルされる点に注意すること。
- 覚え書き
-
◆ create()
| static Ptr< OCRTesseract > cv::text::OCRTesseract::create |
( |
const char * | datapath = NULL, |
|
|
const char * | language = NULL, |
|
|
const char * | char_whitelist = NULL, |
|
|
int | oem = OEM_DEFAULT, |
|
|
int | psmode = PSM_AUTO ) |
|
static |
| Python: |
|---|
| cv.text.OCRTesseract.create( | [, datapath[, language[, char_whitelist[, oem[, psmode]]]]] | ) -> | retval |
| cv.text.OCRTesseract_create( | [, datapath[, language[, char_whitelist[, oem[, psmode]]]]] | ) -> | retval |
OCRTesseract クラスのインスタンスを生成する。Tesseract を初期化する。
- 引数
-
| datapath | "/" で終わる tessdata の親ディレクトリの名前。NULL の場合はシステムのデフォルトディレクトリが使用される。 |
| language | ISO 639-3 コード。NULL の場合はデフォルトで "eng" になる。 |
| char_whitelist | 認識に使用する文字のリストを指定する。NULL の場合は ""(すべての文字が認識に使用される)がデフォルトとなる。 |
| oem | tesseract-ocr は複数の OCR エンジンモード (OEM) を提供しており、デフォルトでは tesseract::OEM_DEFAULT が使用される。その他の指定可能な値については tesseract-ocr の API ドキュメントを参照のこと。 |
| psmode | tesseract-ocr は複数のページセグメンテーションモード (PSM) を提供しており、tesseract::PSM_AUTO(完全自動レイアウト解析)が使用される。その他の指定可能な値については tesseract-ocr の API ドキュメントを参照のこと。 |
- 覚え書き
- char_whitelist のデフォルト値は OpenCV 4.7.0/3.19.0 以降、"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" から "" に変更された。
◆ run() [1/4]
| Python: |
|---|
| cv.text.OCRTesseract.run( | image, min_confidence[, component_level] | ) -> | retval |
| cv.text.OCRTesseract.run( | image, mask, min_confidence[, component_level] | ) -> | retval |
◆ run() [2/4]
| String cv::text::OCRTesseract::run |
( |
InputArray | image, |
|
|
int | min_confidence, |
|
|
int | component_level = 0 ) |
| Python: |
|---|
| cv.text.OCRTesseract.run( | image, min_confidence[, component_level] | ) -> | retval |
| cv.text.OCRTesseract.run( | image, mask, min_confidence[, component_level] | ) -> | retval |
◆ run() [3/4]
| virtual void cv::text::OCRTesseract::run |
( |
Mat & | image, |
|
|
Mat & | mask, |
|
|
std::string & | output_text, |
|
|
std::vector< Rect > * | component_rects = NULL, |
|
|
std::vector< std::string > * | component_texts = NULL, |
|
|
std::vector< float > * | component_confidences = NULL, |
|
|
int | component_level = 0 ) |
|
virtual |
| Python: |
|---|
| cv.text.OCRTesseract.run( | image, min_confidence[, component_level] | ) -> | retval |
| cv.text.OCRTesseract.run( | image, mask, min_confidence[, component_level] | ) -> | retval |
◆ run() [4/4]
| virtual void cv::text::OCRTesseract::run |
( |
Mat & | image, |
|
|
std::string & | output_text, |
|
|
std::vector< Rect > * | component_rects = NULL, |
|
|
std::vector< std::string > * | component_texts = NULL, |
|
|
std::vector< float > * | component_confidences = NULL, |
|
|
int | component_level = 0 ) |
|
virtual |
| Python: |
|---|
| cv.text.OCRTesseract.run( | image, min_confidence[, component_level] | ) -> | retval |
| cv.text.OCRTesseract.run( | image, mask, min_confidence[, component_level] | ) -> | retval |
tesseract-ocr API を使用してテキストを認識する。
画像を入力として受け取り、認識されたテキストを output_text 引数に返す。オプションで、見つかった個々のテキスト要素(単語など)のRectや、それらのテキスト要素とその信頼度の値のリストも提供する。
- 引数
-
| image | 入力画像 CV_8UC1 または CV_8UC3 |
| output_text | tesseract-ocr の出力テキスト。 |
| component_rects | 指定された場合、検出された個々のテキスト要素(例: 単語やテキスト行)の Rect のリストを出力する。 |
| component_texts | 指定された場合、検出された個々のテキスト要素(例: 単語やテキスト行)の認識結果のテキスト文字列のリストを出力する。 |
| component_confidences | 指定された場合、検出された個々のテキスト要素(例: 単語やテキスト行)の認識に対する信頼度値のリストを出力する。 |
| component_level | OCR_LEVEL_WORD(デフォルト)、または OCR_LEVEL_TEXTLINE。 |
cv::text::BaseOCR を実装する。
◆ setWhiteList()
| virtual void cv::text::OCRTesseract::setWhiteList |
( |
const String & | char_whitelist | ) |
|
|
pure virtual |
| Python: |
|---|
| cv.text.OCRTesseract.setWhiteList( | char_whitelist | ) -> | None |
このクラス詳解は次のファイルから抽出されました: