百度识别文字接口(银行卡/行驶证/驾驶证/文字识别等)

news/2024/11/8 18:44:01/

$url = ‘https://aip.baidubce.com/oauth/2.0/token’;
$post_data[‘grant_type’] = ‘client_credentials’;
$post_data[‘client_id’] = ‘client_id’;
$post_data[‘client_secret’] = ‘client_secret’;

o = " " ; f o r e a c h ( o = ""; foreach ( o="";foreach(post_data as $k => $v) {
o . = " o .= " o.="k=" . urlencode($v) . “&”;
}
p o s t d a t a = s u b s t r ( post_data = substr( postdata=substr(o, 0, -1);
r e s = r e q u e s t p o s t ( res = request_post( res=requestpost(url, $post_data);

r e s = j s o n d e c o d e ( res = json_decode( res=jsondecode(res, true);
$token = $res[‘access_token’];
$path=“http://” . $_SERVER[‘HTTP_HOST’] . ‘/’ . $pinfo[‘pcvalue’];
$img = @file_get_contents(“http://” . $_SERVER[‘HTTP_HOST’] . ‘/’ . $pinfo[‘pcvalue’]);

//$img = @file_get_contents(‘sf1.jpg’);
i m g = b a s e 6 4 e n c o d e ( img = base64_encode( img=base64encode(img);
$bodys = array(
“image” => i m g , ) ; / / img, ); // img,);//pinfo[‘attributeid’] = 151;

switch ($pinfo[‘attributeid’]) {
case 172: //行驶证正面
$bodys[‘vehicle_license_side’] = ‘front’;
$url = ‘https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license?access_token=’ . $token;
break;
case 171: //行驶证反面
$bodys[‘vehicle_license_side’] = ‘back’;
$url = ‘https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license?access_token=’ . $token;
break;
case 205: //驾驶证
$url = ‘https://aip.baidubce.com/rest/2.0/ocr/v1/driving_license?access_token=’ . $token;
break;
case 151: //银行卡
$url = ‘https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard?access_token=’ . $token;
break;
case 148: //身份证正面
$bodys[‘id_card_side’] = ‘front’;
$url = ‘https://aip.baidubce.com/rest/2.0/ocr/v1/idcard?access_token=’ . $token;
break;
case 149: //身份证反面
$bodys[‘id_card_side’] = ‘back’;
$url = ‘https://aip.baidubce.com/rest/2.0/ocr/v1/idcard?access_token=’ . $token;
break;
case 211: //壹佳客APP
$url=‘https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic?access_token=’ . $token;
break;
}

r e s = r e q u e s t p o s t ( res = request_post( res=requestpost(url, $bodys);

$str = “

”;
a r r = j s o n d e c o d e ( arr = json_decode( arr=jsondecode(res, true);
$arr[‘words_result’] = $pinfo[‘attributeid’] == 151 ? $arr[‘result’] : a r r [ ′ w o r d s r e s u l t ′ ] ; i f ( arr['words_result']; if ( arr[wordsresult];if(arr[‘words_result’]) {
$updatesql = “UPDATE " . e c s − > t a b l e ( ′ u s e r p r o d u c t i n f o ′ ) . " S E T r e m a r k = ′ ecs->table('user_product_info') . " SET remark=' ecs>table(userproductinfo)."SETremark=res’ WHERE id = ‘$infoid’”;
d b − > q u e r y ( db->query( db>query(updatesql);
if ( KaTeX parse error: Expected '}', got 'EOF' at end of input: … foreach (arr[‘words_result’] as $k => $v) {
$str .= “”;
}
}
}
$str .= “
” . $k . “:” . KaTeX parse error: Expected 'EOF', got '}' at position 27: …/tr>"; }̲ } else { …arr[‘words_result’] as $k => $v) {
$str .= “
” . $k . “:” . $v[‘words’] . “
”;
$reArr = array(‘id’ => $infoid, ‘str’ => $str);
————————————————
版权声明:本文为CSDN博主「花花的牛」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq1714594061/article/details/105244893


http://www.ppmy.cn/news/665743.html

相关文章

CSS自定义字体,在线字体格式转换

在线字体格式转换地址:https://www.fontke.com/tool/convfont/ font-face { font-family: YourWebFontName; src: url(YourWebFontName.eot); /* IE9 Compat Modes */ src: url(YourWebFontName.eot?#iefix) format(embedded-opentype), /* IE6-IE8 */ url(YourW…

【批量行驶证识别】如何批量行驶证OCR识别行驶本行车本图片或复印件并导出至excel表格或文本格式,下面教你方法

继上一期,后台有人留言,是否有批量行驶证的识别导出表格 那么经过几个礼拜的研究,决定出一个批量行驶证的照片识别并导出Excel还有可以输出文本的 有的人叫行车本这个无所谓,我还特意去查了行车本就叫行驶本 下面对作品使用做一…

行驶证OCR识别,信息提取

司机朋友还在为办理车险、财险以及汽车相关业务时,不断录入行驶证信息而烦恼吗?广大交警朋友还为执法时,一个又一个需要手动登记的行驶证而头疼吗?不要紧,你们的福音来啦!可以集成于移动端的行驶证识别SDK“…

基于Opencv和Tesseract的行驶证识别系统设计

张伟超, 肖中俊, 严志国. 基于Opencv和Tesseract的行驶证识别系统设计[J]. 齐鲁工业大学学报, 2020, 34(1): 47-52. DOI: 10.16442/j.cnki.qlgydxxb.2020.01.009 ZHANG W C, XIAO Z J, YAN Z G. Design of Vehicle License Identification System Based on OpenCV and Tesser…

(整理)HTML字体标记:标题字体,字体大小,物理字体,逻辑字体,字体颜色,客户端字体,字符实体

HTML字体标记 HTML字体标记包括:标题字体,字体大小,物理字体,逻辑字体,字体颜色,客户端字体,字符实体等. 1.标题字体: <h#> ... </h#> #1, 2, 3, 4, 5, 6 <h1 align"center">居中显示标题</h1> <h1 style "background-color:#ff000…

【工具】在TTF字体中提取想要的文字,让字体文件变迷你

看到个非常实用的字体剪辑博文&#xff0c;记下以备后用。原地址为http://blog.csdn.net/ldpjay/article/details/46561031&#xff0c;大家可以到原地址查看。 【说明】 游戏中经常需要用到各种字体&#xff0c;但是网上下载的TTF字体文件最小也有好几兆&#xff0c;要是游戏中…

英文字体展示(18号字体大小)

等宽编程字体可在下面的网站动态查看效果: Programming Fonts - Test Drive 等宽字体下载: GitHub - ProgrammingFonts/ProgrammingFonts: This is a collection of programming fonts, just share this with the programmers. Now there are 108 kinds of fantastic fonts!…

汽车驾照分类

驾照级别分类 公安部正式发布《机动车驾驶证业务工作规范》规定&#xff0c;推出机动车驾驶证分级制&#xff0c;将驾照分为A1、A2、A3、B1、B2、C1、C2、C3、C4、D、E、F、M、N、P共15个级别。 公安部根据不同车型的驾驶难度和安全要求&#xff0c;将目前驾驶证签注的3种准驾…