windows8.1
Visual studio 2013
使用言語 C++
いつもお世話になっております。
お聞きしたいのは、TesseractとOpenCVを使った文字認識についてなんですが、
http://whoopsidaisies.hatenablog.com/en ... /12/003100
こちらのサイトのコードを実行したらTesseract not foundと表示されてエラーを起こします。
tessdataのパスは繋いでるはずなんですがどうしても実行できません。
ご指南、よろしくお願いします。
Tesseract環境を作るために参考にしたサイト
http://independence-sys.net/main/?p=1777
コード
#include <opencv2/opencv.hpp>
#include <opencv2/text.hpp>
void main()
{
// 画像読み込み
auto image = cv::imread("1.png");
// グレースケール化
cv::Mat gray;
cv::cvtColor(image, gray, CV_RGB2GRAY);//COLOR_RGB2GRAY
// 文字認識クラスのインスタンス生成
auto ocr = cv::text::OCRTesseract::create("~\Tesseract-OCR\tessdata", "eng");
std::string text;
std::vector<cv::Rect> boxes;
std::vector<std::string> words;
std::vector<float> confidences;
// 文字認識の実行
ocr->run(gray, text, &boxes, &words, &confidences);
// 結果出力
printf("%s\n", text.c_str());
// 文字のかたまりごとに出力
printf(" 文字 | 位置 | 大きさ | 信頼度\n");
printf("-----------+------------+------------+----------\n");
for (int i = 0; i < boxes.size(); i++)
{
printf("%-10s | (%3d, %3d) | (%3d, %3d) | %f/n",
words[i].c_str(),
boxes[i].x, boxes[i].y,
boxes[i].width, boxes[i].height,
confidences[i]);
}
}
OCRTesseract(33): Tesseract not found.
~/Tesseract - OCR/tessdata
eng
OCRTesseract(00): Tesseract not found.
続行するには何かキーを押してください . . .