嗨,谁能帮我安装Tesseract OCR for php没有作曲家。如何在xampp服务器上使用它,以便代码可以用于开发web应用程序。提前感谢
发布于 2022-02-09 23:46:05
我知道这很古老,但还是能帮到我.这是我为使用最新的没有作曲家的Tesseract而创建的代码。对于那些问为什么,为什么,而不是创造一个解决方案,为什么浪费人们的阅读时间,当你不明白?
<?php
require_once "./tesseract-ocr/src/TesseractOCR.php";
require_once "./tesseract-ocr/src/Command.php";
require_once "./tesseract-ocr/src/FriendlyErrors.php";
require_once "./tesseract-ocr/src/Process.php";
require_once "./tesseract-ocr/src/TesseractOcrException.php";
require_once "./tesseract-ocr/src/TesseractNotFoundException.php";
require_once "./tesseract-ocr/src/ImageNotFoundException.php";
require_once "./tesseract-ocr/src/UnsuccessfulCommandException.php";
$filepath = "./images/processing";
$dir = new DirectoryIterator("$filepath");
use thiagoalessio\TesseractOCR\TesseractOCR;
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot()) {
$filename = $fileinfo->getFilename();
$fullfilepath = $filepath . "/" . $filename;
$ocr = new TesseractOCR("$filename");
try {
$content = $ocr->run();
}
catch (exception $e) {
echo "$filename - No text, good image\n";
continue;
}
echo "$filename - There's Text!\n";
die();
}
}
?>
在这种情况下,我使用Tesseract只是为了检测图像中是否有文本(这对我来说是不好的)。
https://stackoverflow.com/questions/49141503
复制相似问题