vs2010调用tesseract识别汉字乱码怎么解决
最近使用vs2010调用tesseract识别汉字乱码,是编码的问题吗,识别数字是没有问题的,程序如下:
#pragma comment(lib, "libtesseract302.lib")
#include "baseapi.h"
#include "basedir.h"
#include "strngs.h"
#include "allheaders.h"
int main()
{
char *outText;
tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();
// Initialize tesseract-ocr with English, without specifying tessdata path
if (api->Init(NULL, "eng")) {
fprintf(stderr, "Could not initialize tesseract.\n");
exit(1);
}
// Open input image with leptonica library
Pix *image = pixRead("D:/77.jpg");
api->SetImage(image);
// Get OCR result
outText = api->GetUTF8Text();
printf("OCR output:%s \n", outText);
system("pause");
// Destroy used object and release memory
api->End();
delete [] outText;
pixDestroy(&image);
return 0;
}