-2
我们已通过与具有文本“Hello World”和正方体OCR完美显示效果的“Hello World”单行的图像。如何使用Tesseract OCR从图像中提取多行?
但是,当我们与多行文本
世界,你好
通过图像你怎么
它不会显示任何东西。有什么问题?任何人都可以帮助我吗?我需要迫切help.please answer.Thanks提前:)
这里是我们的代码:
#include "stdafx.h"
#include <iostream>
#include <baseapi.h>
#include <allheaders.h>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
tesseract::TessBaseAPI api;
api.Init("", "eng", tesseract::OEM_DEFAULT);
api.SetPageSegMode(static_cast<tesseract::PageSegMode>(7));
api.SetOutputName("out");
cout<<"File name:";
char image[256];
cin>>image;
PIX *pixs = pixRead(image);
STRING text_out;
api.ProcessPages(image, NULL, 0, &text_out);
cout<<text_out.string();
ofstream files;
files.open("out.txt");
files << text_out.string()<<endl;
files.close();
cin>> image;
return 0;
}