I'm not a C++ developer and I'm new to the project so I don't want to disturb the repository with my code...but, I've made some changes that could be interesting.
my purpose was to use libTesseract (3) from a Delphi application.
first change, I've added a function to deal with in-memory image.
TESS_API BOOL TESS_CALL TessBaseAPIProcessPagesData(TessBaseAPI* handle, const unsigned char* imagedata, int imagesize, ETEXT_DESC* monitor, TessResultRenderer* renderer);
the code is almost the same as for stdin but with provided imagedata and with a monitor to handle progression.
then I'de like to add my own output handler so I've added this function
typedef int(*WRITE_FUNC)(void* sender, const char* data, int size);
TESS_API void TESS_CALL TessResultRendererWriteCallback(TessResultRenderer* renderer, WRITE_FUNC writefunc, void* sender);
with just a fix on TessResultRenderer
void TessResultRenderer::AppendData(const char* s, int len) {
int n = writefunc_ ? writefunc_(writesender_, s, len) : fwrite(s, 1, len, fout_);
if (n != len) happy_ = false;
}
Now I am able to convert any image from a memory stream to a any kind of stream...this is usefull for database image processing.
it could be better with a source image streaming but it require more changes.