react-native-tesseract-ocr白名单数字只会带来相同图像的错误值

时间:2018-04-05 09:43:31

标签: react-native ocr tesseract

我正在使用react-native-tesseract-ocr来获取图片中的数字,但是当我添加白名单和黑名单时,相同图像的结果不一致。使用此图片的示例Image Used

目的是让图像右下方的数字为2。

这里是不一致的, 当我使用选项

const tessOptions = {
  whitelist: null, 
  blacklist: '1234567890\'!"#$%&/()={}[]+*-_:;<>'
};
RNTesseractOcr.recognize(imgPath, lang, tessOptions)

我得到了这个结果

'OCR Result: ', 'Tms IS a small demunshanon pdime ,\n\n‘us‘ «m use In me Vmua‘ Mechamcs “Anna‘s Mme ten And more\n\num And mare ten And more taxi And mare um\n\nAnd mare text And more text And mare ten And more ‘exl, And mare\num And mare ten Bonng‘ zzzzz And mare text And mm text And\nmare um And mare ten, And more text And mare ten And more ‘exl,\nAnd mare text And more text\n\nAnd mare text And more text And mare ten And more ‘exl, And mare\num And mare ten And more taxi Even mom, Cunnnued an Page 2 ,'

当我使用选项时

const tessOptions = {
  whitelist: "0123456789", 
  blacklist: "!?@#$%&*()<>_-+=/:;'\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
};

我得到了这个结果

'OCR Result: ', '1211215 2 2211211122112215112212121 21211212 7\n\n12222221 2222111 2212 111212221 2112211211122 2122211212 2212112 12122 22121 1112122\n\n2222 21111 2112112 12122 22121 111212222121 21111 211212 22122\n\n21121 2112112 221222 22121 1112112 2222 21111 2112112 12122 22121 1112222211 22111 211212\n2222 21111 2112112 12122 521121222222 21121 2112122 221222 22121 111212 2222 21111\n211212 2222 21121 2112112 221222 22121 1112112 2222 21111 2112112 12122 22121 1112222211\n21121 2112112 221222 22121 1112112 2222\n\n21121 2112112 221222 22121 1112112 2222 21111 2112112 12122 22121 1112222211 22111 211212\n2222 21111 2112112 12122 22121 111212222121 51211 11121122 0211211122211 221 112212 2 2'

是的,结果是数字,但它们来自哪里?,有没有人有明确的例子,只列出数字白名单,或者我使用第一个选项,然后用javascript手动过滤数字?

0 个答案:

没有答案
相关问题