OpenCV 4.13.0
Open Source Computer Vision
読み込み中...
検索中...
見つかりません
🤖 AIによる機械翻訳(非公式) — これは OpenCV 4.13.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。
cv::text::OCRTesseract クラスabstract

OCRTesseract クラスは C++ における tesseract-ocr API (v3.02.02) とのインターフェースを提供する。続き...

#include <opencv2/text/ocr.hpp>

Collaboration diagram for cv::text::OCRTesseract:

公開メンバ関数

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
 
- Public Member Functions inherited from cv::text::BaseOCR
virtual ~BaseOCR ()
 

静的公開メンバ関数

static Ptr< OCRTesseractcreate (const char *datapath=NULL, const char *language=NULL, const char *char_whitelist=NULL, int oem=OEM_DEFAULT, int psmode=PSM_AUTO)
 OCRTesseract クラスのインスタンスを生成する。Tesseract を初期化する。
 

詳細説明

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 の場合はシステムのデフォルトディレクトリが使用される。
languageISO 639-3 コード。NULL の場合はデフォルトで "eng" になる。
char_whitelist認識に使用する文字のリストを指定する。NULL の場合は ""(すべての文字が認識に使用される)がデフォルトとなる。
oemtesseract-ocr は複数の OCR エンジンモード (OEM) を提供しており、デフォルトでは tesseract::OEM_DEFAULT が使用される。その他の指定可能な値については tesseract-ocr の API ドキュメントを参照のこと。
psmodetesseract-ocr は複数のページセグメンテーションモード (PSM) を提供しており、tesseract::PSM_AUTO(完全自動レイアウト解析)が使用される。その他の指定可能な値については tesseract-ocr の API ドキュメントを参照のこと。
覚え書き
char_whitelist のデフォルト値は OpenCV 4.7.0/3.19.0 以降、"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" から "" に変更された。

◆ run() [1/4]

String cv::text::OCRTesseract::run ( InputArray image,
InputArray mask,
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() [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

cv::text::BaseOCR を実装する。

◆ 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_texttesseract-ocr の出力テキスト。
component_rects指定された場合、検出された個々のテキスト要素(例: 単語やテキスト行)の Rect のリストを出力する。
component_texts指定された場合、検出された個々のテキスト要素(例: 単語やテキスト行)の認識結果のテキスト文字列のリストを出力する。
component_confidences指定された場合、検出された個々のテキスト要素(例: 単語やテキスト行)の認識に対する信頼度値のリストを出力する。
component_levelOCR_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

このクラス詳解は次のファイルから抽出されました: