请选择 进入手机版 | 继续访问电脑版
帖子
帖子
用户
博客
课程
123下一页
返回列表 发新帖
显示全部楼层
216
帖子
5
勋章
5750
Y币

UIBaiduOCR模块demo示例

[复制链接]
发表于 2018-11-20 22:19:00
      UIBaiduOCR模块封装了百度文字识别中带UI的身份证识别功能,同时提供了本地质量控制能力,提供给开发者本地检测身份证的功能。


点击进入模块详情

  1. <!DOCTYPE html>
  2. <html>
  3.         <head>
  4.                 <title>Module Develop</title>
  5.                 <meta charset="utf-8">
  6.                 <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
  7.                 <style type="text/css">
  8.                         html, body {
  9.                                 height: 100%
  10.                         }
  11.                         body {
  12.                                 background-color: #fff;
  13.                                 margin: 0;
  14.                         }
  15.                         #wrap {
  16.                                 height: 100%;
  17.                                 position: relative;
  18.                         }
  19.                         #header {
  20.                                 padding-top: 20px;
  21.                                 background-color: #5082c2;
  22.                                 height: 44px;
  23.                                 position: relative;
  24.                         }
  25.                         #header h1 {
  26.                                 font-size: 20px;
  27.                                 height: 44px;
  28.                                 line-height: 44px;
  29.                                 margin: 0em;
  30.                                 color: #fff;
  31.                                 margin-left: 100px;
  32.                                 margin-right: 100px;
  33.                                 text-align: center;
  34.                         }
  35.                         #main {
  36.                                 display: -webkit-box;
  37.                                 -webkit-box-orient: vertical;
  38.                                 -webkit-box-pack: center;
  39.                         }
  40.                         a.button {
  41.                                 display: -webkit-box;
  42.                                 -webkit-box-orient: vertical;
  43.                                 -webkit-box-pack: center;
  44.                                 -webkit-box-align: center;
  45.                                 height: 32px;
  46.                                 margin: 8px;
  47.                                 background-color: rgba(240,240,240,1.0);
  48.                                 border-color: rgba(220,220,220,1.0);
  49.                                 border-width: 2px;
  50.                                 border-style: solid;
  51.                         }
  52.                         a.active {
  53.                                 background-color: rgba(240,240,240,0.7);
  54.                         }
  55.                 </style>
  56.         </head>
  57.         <body>
  58.                 <div id="wrap">
  59.                         <div id="main">
  60.                                 <a class="button" tapmode="active" onclick="initAccessTokenWithAkSk()" >sdk初始化</a>
  61.                                 <a class="button" tapmode="active" onclick="initCameraNative()" >本地能力初始化(仅安卓)</a>
  62.                                 <a class="button" tapmode="active" onclick="openIDCard1()" >身份证正面识别</a>
  63.                                 <a class="button" tapmode="active" onclick="openIDCard2()" >身份证反面识别</a>
  64.                                 <div class="clickbtn" tapmode="active" onclick="openBankCard()" >
  65.                                         银行卡识别
  66.                                 </div>
  67.                                 <br/>
  68.                                 <br/>
  69.                                 <img id="path" width="200"/>
  70.                         </div>
  71.                 </div>
  72.         </body>
  73.         <script type="text/javascript" src="../script/api.js"></script>
  74.         <script type="text/javascript">
  75.                 var demo = null;
  76.                 apiready = function() {
  77.                         demo = api.require('UIBaiduOCR');
  78.                         if (!demo) {
  79.                                 alert("请添加模块后编译");
  80.                                 return;
  81.                         }
  82.                 }
  83.                 function initAccessTokenWithAkSk() {
  84.                         demo.initAccessTokenWithAkSk({
  85.                                 apiKey : 'KOxyssq1qrRCdbmSZB9CrY60',
  86.                                 secretKey : 'Nj2VXOMTPDUGUHkIIC8B5R8h0SYHBHUv'
  87.                         }, function(ret, err) {
  88.                                 alert(JSON.stringify(ret) + "  " + JSON.stringify(err));
  89.                         });
  90.                 }

  91.                 function initCameraNative() {
  92.                         demo.initCameraNative(function(ret, err) {
  93.                                 alert(JSON.stringify(ret) + "  " + JSON.stringify(err));
  94.                         });
  95.                 }

  96.                 function openIDCard1() {
  97.                         demo.openIDCard({
  98.                                 isCardFront : true,
  99.                                 isNativeManual : true
  100.                         }, function(ret, err) {
  101.                                 alert(JSON.stringify(ret) + "  " + JSON.stringify(err));
  102.                                 $api.attr($api.byId('path'), 'src', ret.filePath);
  103.                         });
  104.                 }

  105.                 function openIDCard2() {
  106.                         demo.openIDCard({
  107.                                 isCardFront : false,
  108.                                 isNativeManual : true
  109.                         }, function(ret, err) {
  110.                                 alert(JSON.stringify(ret) + "  " + JSON.stringify(err));
  111.                                 $api.attr($api.byId('path'), 'src', ret.filePath);
  112.                         });
  113.                 }

  114.                 function openBankCard() {
  115.                         demo.openBankCard(function(ret, err) {
  116.                                 alert(JSON.stringify(ret) + "  " + JSON.stringify(err));
  117.                                 $api.attr($api.byId('path'), 'src', ret.filePath);
  118.                         });
  119.                 }
  120.         </script>
  121. </html>
复制代码


6
帖子
0
勋章
30
Y币
终于找到大神作者了.最近我的升级了两个版本,模块UIBaiduOCR 出现了部分机型闪退的问题,可以帮忙看下是什么原因吗?
6
帖子
0
勋章
30
Y币
RuntimeException[android.hardware.Camera.java,native_autoFocus,-2]

java.lang.RuntimeException: autoFocus failed\n\tat android.hardware.Camera.native_autoFocus(Native Method)\n\tat android.hardware.Camera.autoFocus(Camera.java:1476)\n\tat com.apicloud.FNPhotograph.CameraPreview.autoFocus(CameraPreview.java:192)\n\tat com.apicloud.FNPhotograph.FocusRender.onTouchEvent(FocusRender.java:121)\n\tat android.view.View.dispatchTouchEvent(View.java:12533)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3032)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3032)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3032)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3032)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3032)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3032)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)\n\tat android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3032)\n\tat android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2719)\n\tat com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:461)\n\tat com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1830)\n\tat android.app.Activity.dispatchTouchEvent(Activity.java:3453)\n\tat com.uzmap.pkg.uzcore.UZAppActivity.dispatchTouchEvent(Unknown Source:17)\n\tat com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:419)\n\tat android.view.View.dispatchPointerEvent(View.java:12774)\n\tat android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5263)\n\tat android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5063)\n\tat android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4578)\n\tat android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4631)\n\tat android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4597)\n\tat android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4737)\n\tat android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4605)\n\tat android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4794)\n\tat android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4578)\n\tat android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4631)\n\tat android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4597)\n\tat android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4605)\n\tat android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4578)\n\tat android.view.ViewRootImpl.deliverInputEvent(ViewRootImp

设备VCE-AL00
操作系统 9
错误次数 1
6
帖子
0
勋章
30
Y币
NullPointerException[com.baidu.ocr.ui.camera.Camera1Control$2.java,onPreviewFrame,305]

java.lang.NullPointerException: Attempt to get length of null array\n\tat com.baidu.ocr.ui.camera.Camera1Control$2.onPreviewFrame(Camera1Control.java:305)\n\tat android.hardware.Camera$EventHandler.handleMessage(Camera.java:1235)\n\tat android.os.Handler.dispatchMessage(Handler.java:102)\n\tat android.os.Looper.loop(Looper.java:135)\n\tat android.app.ActivityThread.main(ActivityThread.java:5359)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat java.lang.reflect.Method.invoke(Method.java:372)\n\tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:919)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:714)\n

vivo Y66i
7.1.2
1
6
帖子
0
勋章
30
Y币
这是这两天的报错

本帖子中包含更多资源,您需要 登录 才可以下载或查看,没有帐号?立即注册

X
216
帖子
5
勋章
5750
Y币
收到。
19
帖子
0
勋章
43
Y币
该模块不能获取身份证头像吗
27
帖子
0
勋章
1万+
Y币
怎么上传图片啊??
216
帖子
5
勋章
5750
Y币
@磊哥 发表于 2019-10-21 11:20
怎么上传图片啊??

自己拿到图片后,ajax上传啥。。。
5
帖子
0
勋章
44
Y币
为啥不能付费呢?
123下一页
您需要登录后才可以回帖 登录

本版积分规则