Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于php的tesseract ocr无响应_Php_Tesseract - Fatal编程技术网

用于php的tesseract ocr无响应

用于php的tesseract ocr无响应,php,tesseract,Php,Tesseract,我正在使用tesseract ocr for php,我已经安装了tesseract并将路径添加到我的环境变量中,它通过命令提示符工作,但当我通过php使用它时,它返回空字符串。下面是我的php代码 <?php require_once '../src/TesseractOCR.php'; $filepath = "text.jpeg"; $tesseractInstance = new TesseractOCR($filepath); $result = $tesseractIn

我正在使用tesseract ocr for php,我已经安装了tesseract并将路径添加到我的环境变量中,它通过命令提示符工作,但当我通过php使用它时,它返回空字符串。下面是我的php代码

<?php

require_once '../src/TesseractOCR.php';

$filepath = "text.jpeg";

$tesseractInstance = new TesseractOCR($filepath);

$result = $tesseractInstance->run();

echo $result;

$x = exec("tesseract.exe test.png test");
echo $x;

$z = (new TesseractOCR($filepath))->run();
echo $z;

$tesseract = new TesseractOCR('text.jpeg');
$y = $tesseract->run();
echo $y;

var_dump($result);
var_dump($x);
var_dump($y);
var_dump($z);

?>
谁能帮我找出问题所在以及如何解决

谢谢,

我就是这样做的:

    <?php
require_once("src/TesseractOCR.php");

$File_exe = "C:/Program Files (x86)/Tesseract-OCR/tesseract.exe";
$image = "C:/xampp/htdocs/PHP/testing.png";
$text = "C:/xampp/htdocs/PHP/out";
$output = exec("\"$File_exe\" \"$image\" \"$text\" "); //Stored the output in a text file I called "out"



$myfile = fopen("out.txt", "r","C:\xampp\htdocs\PHP") or die("No such file"); //Retrieving the output I stored in the text file(The text from the image)
echo fread($myfile,filesize("out.txt")); //Display to screen
fclose($myfile);

?>
    <?php
require_once("src/TesseractOCR.php");

$File_exe = "C:/Program Files (x86)/Tesseract-OCR/tesseract.exe";
$image = "C:/xampp/htdocs/PHP/testing.png";
$text = "C:/xampp/htdocs/PHP/out";
$output = exec("\"$File_exe\" \"$image\" \"$text\" "); //Stored the output in a text file I called "out"



$myfile = fopen("out.txt", "r","C:\xampp\htdocs\PHP") or die("No such file"); //Retrieving the output I stored in the text file(The text from the image)
echo fread($myfile,filesize("out.txt")); //Display to screen
fclose($myfile);

?>
$x=fread($myfile,filesize("out.txt");