简体   繁体   中英

How to use RGB buffer with tesseract?

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM