zdenop / qt-box-editor

QT4 editor of tesseract-ocr box files
https://zdenop.github.io/qt-box-editor/
Apache License 2.0
170 stars 66 forks source link

Build failure with leptonica 1.83 #87

Open risicle opened 1 year ago

risicle commented 1 year ago

Leptonica 1.83 moved a number of struct definitions into "private" headers, notably Pix and Box et al.

This causes a build failure:

src/TessTools.cpp:147:25: error: member access into incomplete type 'PIX' (aka 'Pix')
   l_uint32 *datas = pixs->data;
...

To address this, an extra import of <leptonica/pix_internal.h> needs to be added to src/TessTools.h.

On top of this, it looks like this version got rid of the library's lept alias, so references to -llept in qt-box-editor.pro need to be switched to -lleptonica.

zdenop commented 1 year ago

qt-box-editor was IMO relevant for tesseract 3.x training (legacy engine) and it does not provide any value for the current tesseract version... So what is the value if it is possible to build with the latest version of leptonica&tesseract?

risicle commented 1 year ago

Simply that older leptonica versions have security vulnerabilities meaning we (NixOS) can't ship them.

Perhaps this is an indication that we should just drop the qt-box-editor package, but as long as it's relatively straightforward to keep it building, we probably will do so with patches.

zdenop commented 1 year ago

It is not problem to include patch here, I just wander if really people are actively using this.

dpward commented 1 year ago

Yes. The current version of Tesseract still supports the OCR-based engine. The LSTM model takes significantly longer to train, according to the Tesseract documentation itself.

zdenop commented 1 year ago

LSTM engine does not need to be trained from scratch (legacy engine has to). E.g. you can train and extend only problems. IMO LSTM training is (could be) faster as you do not need to take care about bounding boxes of letters and training based on tutorials like this seem to be pretty easy.

Anyway I made requested changes of QTB code.

dpward commented 1 year ago

Unfortunately LSTM doesn't seem to work well on matching basic monospace without word recognition.