如何使用PHP安装和启动tesseract-ocr

时间:2022-01-08 09:01:19

I am looking for a OCR component that converts images of text into characters using php.

我正在寻找一个OCR组件,使用PHP将文本图像转换为字符。

I got a script tesseract-ocr from google code. How can I install and launch tesseract-ocr through php ?

我从谷歌代码得到了一个脚本tesseract-ocr。如何通过php安装和启动tesseract-ocr?

As I am a beginner in PHP, I cant come up with the documentation they provided. I need some simple steps to install and launch ? thanks in advance.

由于我是PHP的初学者,我无法提供他们提供的文档。我需要一些简单的步骤来安装和启动?提前致谢。

2 个解决方案

#1


2  

Wow, that answer is the hard way. I'm a PHP programmer and the website linked for wrapping c++ with PHP makes my brain hurt.

哇,答案很难。我是一名PHP程序员,用PHP包装c ++的网站让我的大脑受到伤害。

A better way for someone who is new to PHP is to use the exec() function in PHP to call the command line tesseract binary. You can then work with the output from the exec call in PHP or send the output to a file and work with the file in PHP.

对于刚接触PHP的人来说,更好的方法是使用PHP中的exec()函数来调用命令行tesseract binary。然后,您可以使用PHP中的exec调用的输出,或者将输出发送到文件并使用PHP中的文件。

#2


1  

You will need to setup tesseract according to the documentation that is provided.

您需要根据提供的文档设置tesseract。

Then once tesseract is working correctly from the command-line, you can make the extension to access tesseract from PHP.

然后,一旦tesseract从命令行正常工作,您就可以使扩展程序从PHP访问tesseract。

An excellent guide to wrapping C++ classes in a PHP extension can be found here

可以在此处找到在PHP扩展中包装C ++类的出色指南

#1


2  

Wow, that answer is the hard way. I'm a PHP programmer and the website linked for wrapping c++ with PHP makes my brain hurt.

哇,答案很难。我是一名PHP程序员,用PHP包装c ++的网站让我的大脑受到伤害。

A better way for someone who is new to PHP is to use the exec() function in PHP to call the command line tesseract binary. You can then work with the output from the exec call in PHP or send the output to a file and work with the file in PHP.

对于刚接触PHP的人来说,更好的方法是使用PHP中的exec()函数来调用命令行tesseract binary。然后,您可以使用PHP中的exec调用的输出,或者将输出发送到文件并使用PHP中的文件。

#2


1  

You will need to setup tesseract according to the documentation that is provided.

您需要根据提供的文档设置tesseract。

Then once tesseract is working correctly from the command-line, you can make the extension to access tesseract from PHP.

然后,一旦tesseract从命令行正常工作,您就可以使扩展程序从PHP访问tesseract。

An excellent guide to wrapping C++ classes in a PHP extension can be found here

可以在此处找到在PHP扩展中包装C ++类的出色指南