如何提高tesseract识别数字的结果
我正在开发可识别 ISBN 号码的 iPhone 应用程序(ISBN:978-83-7380-900-0) 我为此使用了 tesseract,但效果不是很好。我可以看到其他应用程序,使用相同的引擎可以更好地工作。
为了限制字符,我使用此配置行: tess->SetVariable("tessedit_char_whitelist", "SN:0123456789X-"); 所以所有的“I”都被转换为“1”,“B”被转换为8。使用这个它不会对这些字母犯错误,这对我来说并不重要。 之后,我使用正则表达式来查找已识别文本的正确部分。
我还裁剪了图像,因此 tesseract 仅识别图像的一部分,其中 isbn 可见(我将颜色矩形放置在相机覆盖层上,因此用户必须将代码放置在正确的位置) 我还将图像大小调整为 1000px 宽度(也尝试了其他尺寸),
当光线很好时效果很好,但当光线不完美时很难正确识别。
isbn 号的最后一位是控制和。
我能做些什么来让它更好地工作? 有没有办法说 tesserect 仅识别给定正则表达式中的文本? 也许我应该先对图像做一些事情?
无法正确识别的示例图像:
http://img412.imageshack.us/i/img0367si.jpg/
http://img264.imageshack.us/i/img0361d.jpg/
I am working on iPhone application that recognizes ISBN numbers (ISBN: 978-83-7380-900-0)
I use tesseract for this, but it is not working very well. I can see other applications, using same engine to work better.
to limit the characters i use this config line:
tess->SetVariable("tessedit_char_whitelist", "SN:0123456789X-");
so all "I" are converted to "1", and "B" to 8. Using this it wont make mistake with those letters, whick are not important to me.
After that i use regular expression to find the correct part of recognized text.
I also crop the image, so tesseract recognizes only part of the image, where isbn is visible (i placed color rect on camera overlay, so user have to place code in correct place)
I also resize the image to 1000px width (also tried other sizes)
It works quite well when the light is excellent, but it is really hard to recognize correctly when the lighting isn't perfect.
The last digit of isbn number is a control sum.
What can I do to make it work better?
Is there any way to say tesserect to recognize text only in given regular expression?
Maybe i should do something with image first?
Sample images, that are not recognized correctly:
http://img412.imageshack.us/i/img0367si.jpg/
http://img264.imageshack.us/i/img0361d.jpg/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用了一些预处理,目前结果相当不错。 (归一化和自动阈值)我用 iPhone 的简单图像处理来做到这一点。我还用 2 倍变焦制作图像。
唯一的问题是,很容易产生模糊图像,然后就无法识别任何东西。
ocr识别过程大约需要4s。它适用于 300 x 109 的图像:19KB
我只是想知道我能做些什么让它工作得更快,这样我就可以拍摄几张图像并处理所有它们。
i used some pre processing and results are quite good at the moment. (normalisation and auto threshold) i do it with simple image processing for iphone. I am also making images with 2x zoom.
The only problem is that it is really easy to make fuzzy image, and then it is imossible to recognize anything.
The process of ocr recognition takes aproximately 4s. and it works on image 300 x 109 : 19KB
I am just wondering what can i do do make it working faster, so i would be able to take several images and process all of them.