534
阿裏雲
行駛證識別__API介紹_文字識別_人工智能圖像類-阿裏雲
本頁麵主要介紹服務對應的接口和返回結果中的關鍵字段的含義,請在閱讀本頁麵之前,了解請求數據格式介紹,了解輸入輸出的通用數據格式。 此外,在本頁最後,附上了駕駛證識別服務調用的程序示例,以供參考。
請求接口
雲市場接口
- 請求方法: POST
- 請求url: 在雲市場搜索
印刷文字識別-行駛證識別,在API接口中找到調用地址
數加接口
- 請求方法: POST
- 請求url: 打開管理控製台,接口名稱選擇
ocr_vehicle_license,查看請求地址
請求參數
| 參數名稱 | 參數類型 | 描述 | 默認值 |
|---|---|---|---|
| image | string | dataType為50, dataValue是base64編碼後的圖像數據 | 空字符串 |
POST請求body 示例如下:
{"inputs": [{"image": {"dataType": 50, #50表示image的數據類型為字符串"dataValue": "base64_image_string" #圖片以base64編碼的string}}]}
返回結果格式
返回結果格式如下:
{"outputs": [{"outputLabel": "ocr_vehicle_license","outputMulti": {},"outputValue": {"dataType": 50,"dataValue": "{"config_str": "", #配置字符串信息"owner": "張三", #所有人名稱"plate_num": "滬A0M084", #車牌號碼"model":"奧德賽HG7420", #品牌型號"vin" : "LSVFF66R8C2116280", #車輛識別代號"engine_num" : "416098", #發動機號碼"register_date": "20121127", #注冊日期"request_id": "84701974fb983158_20160526100112", #請求對應的唯一表示"success": true #識別成功與否 true/false}"}}]}
每一個請求返回的結果都是一個json字符串,由dataValue關鍵詞可以索引到,主要有如下字段:
- config_str: 表示發送請求時候的配置字符串,為json字符串格式,表示輸入時候的配置參數, 類型為字符串
- owner: 所有人名稱, 類型為字符串
- plate_num: 車牌號碼, 類型為字符串
- model: 品牌型號, 類型為字符串
- vin: 車輛識別代號, 類型為字符串
- engine_num: 發動機號碼, 類型為字符串
- register_date: 注冊日期, 類型為字符串
- request_id: 請求對應的唯一表示, 用戶可以保存該字段用以進行問題追溯,類型為字符串
- success: 識別流程是否出現異常, false表示識別失敗,true表示識別成功, 類型為布爾型
程序示例
雲市場
在雲市場搜索印刷文字識別-行駛證識別,在API接口中找到請求示例
數加平台
import java.io.File;import java.io.FileInputStream;import java.io.IOException;import sun.misc.BASE64Encoder;import org.json.JSONObject;import org.json.JSONArray;import org.json.JSONException;@SuppressWarnings("restriction")public class vehicle {/** 獲取參數的json對象*/public static JSONObject getParam(int type, JSONObject dataValue) {JSONObject obj = new JSONObject();try {obj.put("dataType", type);obj.put("dataValue", dataValue);} catch (JSONException e) {e.printStackTrace();}return obj;}/** 獲取參數的json對象*/public static JSONObject getParam(int type, String dataValue) {JSONObject obj = new JSONObject();try {obj.put("dataType", type);obj.put("dataValue", dataValue);} catch (JSONException e) {e.printStackTrace();}return obj;}public static void main(String[] args) {String img_file = "vehicle.jpg";String service_url = "your-service-url";String ak_id = "your access key id";String ak_secret = "your access key secret";// 對圖像進行base64編碼String img_base64 = "";try {File file = new File(img_file);byte[] content = new byte[(int) file.length()];FileInputStream finputstream = new FileInputStream(file);finputstream.read(content);finputstream.close();img_base64 = (new BASE64Encoder()).encode(content);} catch (IOException e) {e.printStackTrace();return;}// 拚裝請求body的json字符串JSONObject request_obj = new JSONObject();try {JSONObject obj = new JSONObject();JSONArray input_array = new JSONArray();obj.put("image", getParam(50, img_base64));input_array.put(obj);request_obj.put("inputs", input_array);} catch (JSONException e) {e.printStackTrace();}String body = request_obj.toString();//Sender代碼參考 https://help.aliyun.com/document_detail/shujia/OCR/ocr-api/sender.htmlString result = Sender.sendPost(service_url, body, ak_id, ak_secret);System.out.println(result);// 解析請求結果try {JSONObject result_obj = new JSONObject(result);JSONArray output_array = result_obj.getJSONArray("outputs");String output = output_array.getJSONObject(0).getJSONObject("outputValue").getString("dataValue"); // 取出結果json字符串JSONObject out = new JSONObject(output);if (out.getBoolean("success")) {String owner = out.getString("owner"); // 獲取所有人String plate_num = out.getString("plate_num"); // 獲取車牌號碼String model_type = out.getString("model"); // 獲取品牌型號String vin = out.getString("vin"); // 獲取車輛識別代碼String engine_num = out.getString("engine_num"); // 獲取發動機號碼String register_date = out.getString("register_date"); // 獲取注冊日期String request_id = out.getString("request_id"); // 獲取request_idSystem.out.printf(" owner : %s n plate_num : %sn model_type : %sn vin : %sn engine_num : %sn register_date : %sn request_id : %sn", owner, plate_num, model_type,vin, engine_num, register_date, request_id);} else {System.out.println("predict error");}} catch (JSONException e) {e.printStackTrace();}}}
最後更新:2016-11-23 16:04:15
上一篇:
駕駛證識別__API介紹_文字識別_人工智能圖像類-阿裏雲
下一篇:
營業執照識別__API介紹_文字識別_人工智能圖像類-阿裏雲
服務連接__基本概念_基本介紹_大數據計算服務-阿裏雲
實例狀態表__附錄_API 參考_雲服務器 ECS-阿裏雲
DML語句__SQL_大數據計算服務-阿裏雲
消息軌跡查詢__消息管理相關接口_Open API_消息隊列 MQ-阿裏雲
接收刪除消息__隊列消息操作_快速入門_消息服務-阿裏雲
1.2 掛載數據盤__ECS快速開始_雲服務器ECS 體驗_體驗館-阿裏雲
GetRole__角色管理接口_RAM API文檔_訪問控製-阿裏雲
depends__服務編排文檔_用戶指南_容器服務-阿裏雲
修改API分組__API分組相關接口_API_API 網關-阿裏雲
堡壘機__使用金融雲產品_金融雲-阿裏雲
相關內容
常見錯誤說明__附錄_大數據計算服務-阿裏雲
發送短信接口__API使用手冊_短信服務-阿裏雲
接口文檔__Android_安全組件教程_移動安全-阿裏雲
運營商錯誤碼(聯通)__常見問題_短信服務-阿裏雲
設置短信模板__使用手冊_短信服務-阿裏雲
OSS 權限問題及排查__常見錯誤及排除_最佳實踐_對象存儲 OSS-阿裏雲
消息通知__操作指南_批量計算-阿裏雲
設備端快速接入(MQTT)__快速開始_阿裏雲物聯網套件-阿裏雲
查詢API調用流量數據__API管理相關接口_API_API 網關-阿裏雲
使用STS訪問__JavaScript-SDK_SDK 參考_對象存儲 OSS-阿裏雲