如何使用 PHP 在网站上实现 OCR?
是否有任何免费的 OCR 库可以在 Linux 服务器上与 PHP 或 Python 一起使用?这个想法是能够上传图像并从中提取字符,或者允许用户绘制字符",并从所述图像中解析它们.
Are there any free OCR libraries that work with PHP or Python on a Linux server? The idea is to be able to upload an image and pull out characters from it, or allow users to "draw characters", and parse them out of said image.
推荐答案
由于您使用的是 Linux 机器,我强烈推荐 Google 的开源项目 ocropus.
Since you're on a Linux box, I would highly recommend Google's open source project ocropus.
它不是 PHP,但我认为它将是您的最佳选择.当然,您可以在 PHP 中通过 exec
调用它.它成熟并且有很多选择.来自项目站点:
It's not PHP, but I think it will be your best option. Of course you can call it from within PHP via exec
. Its mature and has a lot of options. From the project site:
OCRopus 引擎基于两个研究项目:90 年代中期开发并由美国人口普查局部署的高性能手写识别器,以及新颖的高性能布局分析方法.
The OCRopus engine is based on two research projects: a high-performance handwriting recognizer developed in the mid-90's and deployed by the US Census bureau, and novel high-performance layout analysis methods.
还有另一个开源项目,tesseract.我过去也使用过它,并且对结果感到满意.包括培训、限制字母等.
There is also another open source project, tesseract. I've used this in the past as well and have been pleased with the results. Includes training, limiting your alphabet, etc.
相关文章