I`m korean
영어를 못해서 한글로 적습니다.
저도 같은 문제가 있어서 고민 했었는데 원인을 잘 모르겠습니다.
하지만 다음과 같이 하여 사용하고 있습니다.
"baseapi.h", "baseapi.cpp" 파일에 다음과 같은 함수를 새로 작성하여 build 하였습니다.
bool TessBaseAPI::GetUTF8TextEx(char* result, int nMaxLength)
{
if (tesseract_ == NULL || (!recognition_done_ && Recognize(NULL) < 0))
return NULL;
STRING text("");
ResultIterator *it = GetIterator();
do
{
if (it->Empty(RIL_PARA))
continue;
char *para_text = it->GetUTF8Text(RIL_PARA);
text += para_text;
delete []para_text;
} while (it->Next(RIL_PARA));
int nTextLength = text.length();
if (nTextLength >= (nMaxLength - 1))
nTextLength = (nMaxLength - 1);
strncpy(result, text.string(), nTextLength + 1);
return true;
}
기존의 GetUTF8Text 함수가 내부에서 new char[nTExtLength + 1] 로 메모리를 동적할당 하는것을
외부로 바꾸었습니다.
참고 하세요.
--
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en