用于php的tesseract ocr无响应
我正在使用tesseract ocr for php,我已经安装了tesseract并将路径添加到我的环境变量中,它通过命令提示符工作,但当我通过php使用它时,它返回空字符串。下面是我的php代码用于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
<?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");