Tesseract以外还存在哪些OCR选项

Tesseract以外还存在哪些OCR选项

本文介绍了Tesseract以外还存在哪些OCR选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了Tesseract一点,其结果有很多不足之处.我目前正在检测非常小的图像(35x15,无边框,但尝试添加带有imagemagick的图像,而没有ocr优势);它们的范围从2个字符到5个字符,并且是一种非常可靠的字体,但是这些字符足够可变,以至于仅使用图像大小的校验和就不起作用了.

除了坚持使用Tesseract或对其进行完整的定制培训外,OCR还有哪些选项?另外,如果它与Heroku样式托管兼容(至少在我可以编译的地方),那将非常有帮助垃圾箱并将其推开).

解决方案

我已经成功地使用了 GOCR 过去用于小图像OCR.我要说的是,在相当常规的字体上正确设置了灰度选项后,准确度约为85%.当字体变得复杂并且在多行布局中遇到问题时,它会惨遭失败.

还可以查看由Google维护的 Ocropus .它与Tesseract有关,但据我了解,其OCR引擎是不同的.仅使用默认模型,它就可以在高质量图像上实现近99%的精度,可以很好地处理布局,并为HTML输出提供有关格式和行的信息.但是,以我的经验,当图像质量不够好时,它的准确性非常低.话虽如此,培训相对简单,您可能想尝试一下.

它们都可以从命令行轻松调用. GOCR的用法非常简单;只需键入gocr -h,您就应该拥有所需的所有信息. Ocropus有点棘手.这是Ruby中的用法示例:

require 'fileutils'
tmp = 'directory'
file = 'file.png'

`ocropus book2pages #{tmp}/out #{file}`
`ocropus pages2lines #{tmp}/out`
`ocropus lines2fsts #{tmp}/out`
`ocropus buildhtml #{tmp}/out > #{tmp}/output.html`

text = File.read("#{tmp}/output.html")
FileUtils.rm_rf(tmp)

I've used Tesseract a bit and it's results leave much to be desired. I'm currently detecting very small images (35x15, without border, but have tried adding one with imagemagick with no ocr advantage); they range from 2 chars to 5 and are a pretty reliable font, however the characters are variable enough that simply using an image size checksum or such is not going to work.

What options exist for OCR besides sticking with Tesseract or doing a complete custom training of it? Also, it would be VERY helpful if this were compatible with Heroku style hosting (at least where I can compile the bins and shove them over).

解决方案

I have successfully used GOCR in the past for small image OCR. I would say accuracy was around 85%, after getting the grayscale options set properly, on fairly regular fonts. It fails miserably when the fonts get complicated and has trouble with multiline layouts.

Also have a look at Ocropus, which is maintained by Google. Its related to Tesseract, but from what I understand, its OCR engine is different. With just the default models included, it achieves near 99% accuracy on high-quality images, handles layout pretty well and provides HTML output with information concerning formatting and lines. However, in my experience, its accuracy is very low when the image quality is not good enough. That being said, training is relatively simple and you might want to give it a try.

Both of them are easily callable from the command line. GOCR usage is very straightforward; just type gocr -h and you should have all the information you need. Ocropus is a bit more tricky; here's a usage example, in Ruby:

require 'fileutils'
tmp = 'directory'
file = 'file.png'

`ocropus book2pages #{tmp}/out #{file}`
`ocropus pages2lines #{tmp}/out`
`ocropus lines2fsts #{tmp}/out`
`ocropus buildhtml #{tmp}/out > #{tmp}/output.html`

text = File.read("#{tmp}/output.html")
FileUtils.rm_rf(tmp)

这篇关于Tesseract以外还存在哪些OCR选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 18:37