Merge pull request 'Tesseract: Improved detection' (#1459) from heluecht/friendica-addons:tesseract-languages into develop
Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1459
This commit is contained in:
commit
2452b05cc5
1 changed files with 4 additions and 0 deletions
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue