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 文件。 |
- 注意
- 在 OpenCV 4.7.0/3.19.0 之後,char_whitelist 預設值從 "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 引數中返回識別的文字。 可選地還提供找到的各個文字元素的矩形(例如單詞),以及這些文字元素及其置信度值的列表。
- 引數
-
| image | 輸入影像 CV_8UC1 或 CV_8UC3 |
| output_text | tesseract-ocr 的輸出文字。 |
| component_rects | 如果提供,該方法將輸出找到的各個文字元素(例如單詞或文字行)的矩形列表。 |
| 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 | ) |
|
|
純虛擬函式 |
| Python |
|---|
| cv.text.OCRTesseract.setWhiteList( | char_whitelist | ) -> | 無 |
此類文件是從以下檔案生成的