Tesseract: Improved detection

This commit is contained in:
Michael 2024-01-22 18:01:51 +00:00 committed by Hypolite Petovan
parent 446fd9b17b
commit 8b35c9fddb

View file

@ -24,6 +24,10 @@ function tesseract_ocr_detection(&$media)
{ {
$ocr = new TesseractOCR(); $ocr = new TesseractOCR();
try { try {
$languages = $ocr->availableLanguages();
if ($languages) {
$ocr->lang(implode('+', $languages));
}
$ocr->tempDir(System::getTempPath()); $ocr->tempDir(System::getTempPath());
$ocr->imageData($media['img_str'], strlen($media['img_str'])); $ocr->imageData($media['img_str'], strlen($media['img_str']));
$media['description'] = $ocr->run(); $media['description'] = $ocr->run();