added additional options

This commit is contained in:
2023-02-05 12:08:45 +10:00
parent 14e2e2da3e
commit d16231d338

View File

@@ -29,6 +29,10 @@ class OCRController extends ApiController
if ($url !== null) { if ($url !== null) {
$data = []; $data = [];
$oem = $request->get('oem', 0);
$digits = $request->get('digits');
$allowlist = $request->get('allowlist');
$tmpfname = tempnam(sys_get_temp_dir(), 'download'); $tmpfname = tempnam(sys_get_temp_dir(), 'download');
$ch = curl_init(); $ch = curl_init();
@@ -44,6 +48,13 @@ class OCRController extends ApiController
// Raw OCR // Raw OCR
$ocr = new TesseractOCR(); $ocr = new TesseractOCR();
$ocr->image($tmpfname); $ocr->image($tmpfname);
$ocr->oem($oem);
if ($digits !== null) {
$ocr->digits();
}
if ($allowlist !== null) {
$ocr->allowlist($allowlist);
}
$result = $ocr->run(500); $result = $ocr->run(500);
$data['ocr_raw'] = $result; $data['ocr_raw'] = $result;