Open seeyourcell opened 7 years ago
Overall it is a bad habit of using explicit delete operations in a *.cpp sample, since garbage collector should handle that.
Strange error. delete[]
is required here according to documentation.
@lin65505578 could you attach an input image which causes this bug?
@sovrasov,I read the document and the source code. Yes ,delete[] is required. However, If I donot comment these two lines, the "end_to_end_recognition" still still fail. I attach the image and the running code state.
ps: tesseract=>3.04
===================GetUTF8Text() source code======================== ====from " baseapi.cpp"==== /* Make a text string from the internal data structures. / char TessBaseAPI::GetUTF8Text() { if (tesseract_ == NULL || (!recognitiondone && 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)); char result = new char[text.length() + 1]; strncpy(result, text.string(), text.length() + 1); delete it; return result; } ====from "baseapi.h"==== /**
opencv_contrib/ (sample) end_to_end_recognition /ocr_tesseract.cpp ,line 203 and 228. When I use tesseract with opencv to recognize character, the project fail. After I comment these two line,the project is ok. So I think mybe it is a bug.