如何为PHP(开源)设置和运行Tesseract OCR? [英] How to setup and running Tesseract OCR for PHP (opensource)?

查看:798
本文介绍了如何为PHP(开源)设置和运行Tesseract OCR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经根据GitHUb上提供的文档通过MacPorts安装了Tesseract OCR,并且安装成功,并且

I have installed the Tesseract OCR via MacPorts based on the documentation provided on the GitHUb, and they were installed successfully, and

但是,我正在尝试将Tesseract OCR用于PHP( https://github. com/thiagoalessio/tesseract-ocr-for-php ),因此我下载了zip文件并将该库包含到我的php文件中,并使用了

However, I am trying to use Tesseract OCR for PHP (https://github.com/thiagoalessio/tesseract-ocr-for-php), so I download the zip and include the library to my php file, and use the

echo (new TesseractOCR('text.png'))
->run();

但是什么都没有出现.

下面是php中的完整代码

Below is the full code in the php

<?php 

REQUIRE_ONCE __DIR__.'/src/TesseractOCR.php';

echo (new TesseractOCR('text.png'))
    ->run(); 

?>

我的错误日志中包含以下条目:

My error log has this entry:

sh:tesseract:找不到命令

sh: tesseract: command not found

如果您与我分享如何开展这项工作的经验,那就太好了!

If you share me some lights on how to get this work, it will be great!

推荐答案

要使用Tesseract OCR,您可能需要执行以下步骤:

In order to use Tesseract OCR you may need to follow following steps:

1)将Tesseract OCR安装到系统中进行安装

请结帐: https://github.com/tesseract-ocr/tesseract/wiki.

对于Ubuntu Linux系统,您可以运行:

For Ubuntu Linux System you can run :

sudo apt-get install tesseract-ocr

2)制作具有以下内容的composer.json文件:

{"require":{"thiagoalessio/tesseract_ocr": "1.0.0-RC"}}

3)从终端执行命令

composer install

4)最后,执行PHP代码:

require_once "vendor/autoload.php";
echo (new TesseractOCR('test.png'))->run();

希望这对您有用,

这篇关于如何为PHP(开源)设置和运行Tesseract OCR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆