tesseract: Added MeanTextConf() and SetVariable methods - #3
Conversation
SetVariable method
Added SetVariable method wrapper
MeanTextConf() method declaration added
MeanTextConf() method wrapper added
|
The capability is a good idea, but I'm not sure I like the implementation. This is certainly a breach of API style, towards a thin wrapper. For keeping with the existing API style, charWhitelist could be a property on the Tesseract class. Of course, this would be less powerful than exposing the low-level SetVariable, but I don't think that's a bad thing. findText's inability to return a confidence is indeed an annoying limitation :) We could either break the existing API (it's not too late for that) and return an object like with every other find* method, or add an optional parameter to toggle this. |
|
Applied with modified interface (see commit) - I try to prevent stateful methods as much as possible. Use |
Added to tesseract:
MeanTextConf() to get OCR confidence;
SetVariable to set different tesseract configuration variables;
Examples:
var res = tesseract.SetVariable('tessedit_char_whitelist', '0123456789');
console.log('SetVariable', res);
tesseract.image = image;
var text = tesseract.findText('plain');
var res = tesseract.MeanTextConf();
console.log('MeanTextConf', res);