#include #include #include #include #include "checkimage.h" CheckImage::CheckImage(std::string path) { this->path = path; } std::string CheckImage::parse_text() { std::string result; tesseract::TessBaseAPI *ocr = new tesseract::TessBaseAPI(); ocr->Init(NULL, "rus", tesseract::OEM_LSTM_ONLY); ocr->SetPageSegMode(tesseract::PSM_AUTO); cv::Mat im = cv::imread(this->path, cv::IMREAD_COLOR); ocr->SetImage(im.data, im.cols, im.rows, 3, im.step); result = std::string(ocr->GetUTF8Text()); return result; }