接下来写点关于百度云 文字识别的 笔记吧.
在这里我根据返回参数 写了几个对应的实体类来接收,
写的一个java类继承文档提供的关于文字识别操作类
public class AIPOcrJava extends AipOcr { //璁剧疆APPID/AK/SK public static final String APP_ID = "*********"; public static final String API_KEY = "*******************"; public static final String SECRET_KEY = "************************"; public AIPOcrJava(){super(APP_ID, API_KEY, SECRET_KEY); this.setConnectionTimeoutInMillis(60000); this.setSocketTimeoutInMillis(20000); System.setProperty("aip.log4j.conf", "classpath/log4j.properties"); } public AIPOcrJava(String aipId, String aipKey, String secretKey) { super(aipId,aipKey,secretKey); this.setConnectionTimeoutInMillis(60000); this.setSocketTimeoutInMillis(60000); System.setProperty("aip.log4j.conf", "classpath/log4j.properties")
1,通用文字识别
2,通用文字识别高精度版
3,
4
// JSONObject front = idCard("D:\\BaiDuYun\\idCrdFront.jpg", "front");// System.out.println(front.toString()); //{"log_id":3309234557215895357,"words_result": // {"姓名":{"words":"***","location":{"top":444,"left":138,"width":172,"height":63}}, // "民族":{"words":"汉","location":{"top":574,"left":419,"width":36,"height":44}}, // "סַ":{"words":"****************","location":{"top":788,"left":125,"width":568,"height":130}}, // "公民身份号码":{"words":"************00122","location":{"top":1045,"left":361,"width":707,"height":76}}, // "出生":{"words":"******8","location":{"top":0,"left":0,"width":0,"height":0}}, // "性别":{"words":"男","location":{"top":0,"left":0,"width":0,"height":0}}},"words_result_num":6,"image_status":"normal","direction":0}
文章来源: 百度云文字识别 (AIPOcr)