-1

Basic tesseract example uses

auto pixs = pixRead(argv[1]);

to read a TIF image.

However, it isn't clear how to use an RGB buffer (not read from a file).

I tried to find out about Pix but the documentation isn't very clear.

Later it does

tess.SetImage(pixs);

maybe there's a way but I couldn't find the documentation.

PPP
  • 1,279
  • 1
  • 28
  • 71
  • [this page](http://tpgit.github.io/Leptonica/bmpio_8c.html) talks about bitmap io. But it says you can't with windows, just linux, for what ever reason. You may have to write your own interface or treat your memory like a mem file on windows. – lakeweb Mar 03 '20 at 02:10
  • @lakeweb thanks, but I don't need to open bmp files, just process the rgb buffer that already exists in memory. Do you know a way? – PPP Mar 03 '20 at 02:37

2 Answers2

0

That documentation is for a very old version of Leptonica. The current version supports reading image from memory buffer. Look for pixReadMem* methods.

https://github.com/DanBloomberg/leptonica/blob/master/src/allheaders.h

nguyenq
  • 8,212
  • 1
  • 16
  • 16
0

You do not need to create PIX - you can directly set image data to tesseract with SetImage. See e.g. example of putting OpenCV mat to tesseract.

user898678
  • 2,994
  • 2
  • 18
  • 17