OCRHMM with limitated vocabulary

asked 2017-02-02 15:33:47 -0500

Feddav gravatar image

updated 2017-02-03 02:47:45 -0500

Hi to everyone i'm trying to use the OCRHMMDecoder on a video in order to recognize a char. I've take this code from the examples in the installation folder of opencv

string vocabulary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
Ptr<OCRHMMDecoder::ClassifierCallback> ocr = loadOCRHMMClassifierCNN("/home/fed27/opencv_contrib/modules/text/samples/OCRBeamSearch_CNN_model_data.xml.gz");
 ocr->eval(mask, out_classes, out_confidences);
 output=vocabulary[out_classes[i]];
 string s = QString::fromStdString(output) ;
 qWarning() << " OCR_Tesseract  output "<< s ;

it works well but i need the vocabulary limited to few char in order to have more possibilities to guess the right one. If i try to reduce the vocabulary string it gives an error.

thanks you.

edit retag flag offensive close merge delete

Comments

Well that is probably because the model you load is expecting that vocabulary string. Isn't it possible to break open the eval function and hard limit the vocabulary there?

StevenPuttemans gravatar imageStevenPuttemans ( 2017-02-03 08:16:15 -0500 )edit
1

i'm working on this now

Feddav gravatar imageFeddav ( 2017-02-03 08:59:02 -0500 )edit