Выполняю действие согласно
документации :
$image = new Imagick();
$image->readImageBlob($picture);
$image->blurImage();
$data = $image->getImageBlob();
$size = $image->getImageLength();
ob_start();
imagepng($image, null, 0);
$size = ob_get_length();
$data = ob_get_clean();
$tesseract = new thiagoalessio\TesseractOCR\TesseractOCR();
$tesseract->imageData($data, $size)->lang('eng');
$result = $tesseract->run();
echo $result;
$tesseract->clearCache();
Получаю вот такую ошибку:
[15-Nov-2020 19:36:37 UTC] PHP Warning: imagepng() expects parameter 1 to be resource, object given in /var/www/test.php on line 6962
[15-Nov-2020 19:36:37 UTC] PHP Fatal error: Uncaught exception 'thiagoalessio\TesseractOCR\UnsuccessfulCommandException' with message 'Error! The command did not produce any output.
Generated command:
"tesseract" - "/tmp/ocrCaqnvN" -l eng
Returned message:
Tesseract Open Source OCR Engine v4.1.1 with Leptonica
Error in fopenReadStream: file not found
Error in pixRead: image file not found: <br />
Image file <br /> cannot be read!
Error during processing.' in /var/www/vendor/thiagoalessio/tesseract_ocr/src/FriendlyErrors.php:74
Stack trace:
#0 /var/www/vendor/thiagoalessio/tesseract_ocr/src/TesseractOCR.php(39): thiagoalessio\TesseractOCR\FriendlyErrors::checkCommandExecution(Object(thiagoalessio\TesseractOCR\Command), '', 'Tesseract Open ...')
#1 /var/www/test.php(6969): thiagoalessio\TesseractOCR\TesseractOCR->run()
#2 /var/www/test.php(6981): Test->Ttrffde()
#3 {main}
thrown in /var/www/vendor/thiagoalessio/tesseract_ocr/src/FriendlyErrors.php on line 74