Image processing Tesseract OCR:仅识别完整的词典单词
我正在为phonegap使用tesseract OCR插件: 我正在尝试将tesseract配置为仅识别完整的字典单词。也就是说:没有特殊字符,没有后缀或前缀等 由于此项目中的tessdata文件夹不包含任何配置,我想我应该在init上设置配置。 现在我正试图通过修改claseAuxiliar.mm来设置配置,但我不能说我注意到了任何差异,这可能是因为配置错误,或者是我设置错误。以下是我的配置,以及我当前尝试设置它们的方式:Image processing Tesseract OCR:仅识别完整的词典单词,image-processing,cordova,ocr,tesseract,Image Processing,Cordova,Ocr,Tesseract,我正在为phonegap使用tesseract OCR插件: 我正在尝试将tesseract配置为仅识别完整的字典单词。也就是说:没有特殊字符,没有后缀或前缀等 由于此项目中的tessdata文件夹不包含任何配置,我想我应该在init上设置配置。 现在我正试图通过修改claseAuxiliar.mm来设置配置,但我不能说我注意到了任何差异,这可能是因为配置错误,或者是我设置错误。以下是我的配置,以及我当前尝试设置它们的方式: // init the tesseract engine.
// init the tesseract engine.
tesseract = new tesseract::TessBaseAPI();
tesseract->Init([dataPath cStringUsingEncoding:NSUTF8StringEncoding], "eng");
if (!tesseract->SetVariable("segment_penalty_dict_nonword","10"))
printf("Setting variable failed!!!\n");
if (!tesseract->SetVariable("segment_penalty_garbage","10"))
printf("Setting variable failed!!!\n");
if (!tesseract->SetVariable("stopper_nondict_certainty_base","-100"))
printf("Setting variable failed!!!\n");
if (!tesseract->SetVariable("language_model_penalty_non_dict_word","1"))
printf("Setting variable failed!!!\n");
if (!tesseract->SetVariable("language_model_penalty_non_freq_dict_word","1"))
printf("Setting variable failed!!!\n");
if (!tesseract->SetVariable("GARBAGE_STRING","5"))
printf("Setting variable failed!!!\n");
if (!tesseract->SetVariable("NON_WERD","5"))
printf("Setting variable failed!!!\n");
您可能希望尝试抑制系统词典并加载备用自定义词典
谢谢,我正打算这么做。现在使用默认字典,我得到了大量的额外字符。例如,肾上腺素被认为是肾上腺素。我很确定默认字典中没有这个,只需切换字典就可以纠正这个问题吗?也许吧。试试看。