OpenCV 4.12.0
開源計算機視覺
載入中...
搜尋中...
無匹配項
cv::text::OCRTesseract 類參考abstract

OCRTesseract 類提供了一個與 C++ 中的 tesseract-ocr API (v3.02.02) 的介面。 更多...

#include <opencv2/text/ocr.hpp>

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
 
- 從 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。

引數
datapathtessdata 父目錄的名稱,以 "/" 結尾,或 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 文件。
注意
在 OpenCV 4.7.0/3.19.0 之後,char_whitelist 預設值從 "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 引數中返回識別的文字。 可選地還提供找到的各個文字元素的矩形(例如單詞),以及這些文字元素及其置信度值的列表。

引數
image輸入影像 CV_8UC1 或 CV_8UC3
output_texttesseract-ocr 的輸出文字。
component_rects如果提供,該方法將輸出找到的各個文字元素(例如單詞或文字行)的矩形列表。
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)
純虛擬函式
Python
cv.text.OCRTesseract.setWhiteList(char_whitelist) ->

此類文件是從以下檔案生成的