tesserocr icon indicating copy to clipboard operation
tesserocr copied to clipboard

Add progress tracking

Open andriilahuta opened this issue 6 years ago • 4 comments

It can be useful to have a callback with progress updates.

andriilahuta avatar Aug 28 '18 22:08 andriilahuta

Do you have a use-case?

sirfz avatar Aug 29 '18 17:08 sirfz

OCR can be relatively lengthy (especially when multiple languages are loaded), so I'd like to show some kind of progress bar.

andriilahuta avatar Aug 29 '18 17:08 andriilahuta

I was hoping for a "code" example but I think I have a good idea of what you want. Will try to push something soon.

sirfz avatar Aug 30 '18 14:08 sirfz

Ah. I was playing with it and found PROGRESS_FUNC2 callback: https://github.com/tesseract-ocr/tesseract/blob/5fdaa479da2c52526dac1281871db5c4bdaff359/src/ccutil/ocrclass.h#L116-L117 I then subclassed ETEXT_DESC to hold python callback, so I can call it from PROGRESS_FUNC2. It appears to be working, but only recent Tesseract 4 versions have PROGRESS_FUNC2 callback.

andriilahuta avatar Aug 30 '18 15:08 andriilahuta