added additional options
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user