Hello,

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.

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/3d164e72-13e8-442f-836f-702caa9132ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to