本文要推薦的[TOOLFK]在線OCR圖片文字識別工具 ,提供圖像文字識別,提取圖片文字,OCR圖片文字識別,圖片轉文字,把圖片拖拽到上傳框中自動上傳識別,圖片文件最大3M
網站名稱:ToolFk
網站鏈結:https://www.toolfk.com/
工具鏈接:https://www.toolfk.com/tool-online-ocr
代碼教學
本工具[在線OCR圖片轉文字 ]依賴百度OCR接口
STEP 1 界面
STEP2
請參考第三方庫示例
$full_path = \App\Helper\ContentHelper::PATH_APK."/".$filename;
$client = new \App\Helper\Baidu\AipOcr("xxxx", "xxxxx", "xxxxxx");
$image = file_get_contents(storage_path("app/public/".$full_path));
// 調用通用文字識別, 圖片參數爲本地圖片
$res = $client->basicGeneral($image,[
"detect_language" => true,
"detect_direction" => true,
]);
$lists = $res["words_result"];
$result = '';
foreach($lists as $row){
$result .= $row["words"]."\r\n";
}