Added psm in ocr
This commit is contained in:
@@ -31,33 +31,6 @@ use thiagoalessio\TesseractOCR\TesseractOCR;
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/debug-env', function () {
|
|
||||||
return response()->json([
|
|
||||||
'php_sapi' => php_sapi_name(),
|
|
||||||
'user' => trim(shell_exec('whoami')),
|
|
||||||
'which_tesseract' => trim(shell_exec('which tesseract')),
|
|
||||||
'path' => getenv('PATH'),
|
|
||||||
'php_binary' => PHP_BINARY,
|
|
||||||
'disable_functions' => ini_get('disable_functions'),
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
Route::get('/debug-tesseract', function () {
|
|
||||||
$output = [];
|
|
||||||
$status = null;
|
|
||||||
|
|
||||||
exec('/usr/bin/tesseract --version 2>&1', $output, $status);
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => $status,
|
|
||||||
'output' => $output,
|
|
||||||
'whoami' => trim(shell_exec('whoami')),
|
|
||||||
'php_sapi' => php_sapi_name(),
|
|
||||||
'path' => getenv('PATH'),
|
|
||||||
'disable_functions' => ini_get('disable_functions'),
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
Route::post('/verify-ocr', function (Request $request) {
|
Route::post('/verify-ocr', function (Request $request) {
|
||||||
|
|
||||||
if (!$request->has('path')) {
|
if (!$request->has('path')) {
|
||||||
@@ -74,9 +47,8 @@ Route::get('/debug-tesseract', function () {
|
|||||||
// $text = (new TesseractOCR($filePath))->lang('eng')->run();
|
// $text = (new TesseractOCR($filePath))->lang('eng')->run();
|
||||||
$text = (new TesseractOCR($filePath))
|
$text = (new TesseractOCR($filePath))
|
||||||
->executable('/usr/bin/tesseract')
|
->executable('/usr/bin/tesseract')
|
||||||
//->executable('/var/www/tesseract')
|
|
||||||
//->env('PATH', '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin')
|
|
||||||
->lang('eng')
|
->lang('eng')
|
||||||
|
->psm(6)
|
||||||
->run();
|
->run();
|
||||||
|
|
||||||
return response()->json(['success' => true, 'text' => $text]);
|
return response()->json(['success' => true, 'text' => $text]);
|
||||||
|
|||||||
Reference in New Issue
Block a user