文字识别技术是针对图片上的文字进行提取,免去人们手动输入的繁琐。针对证件,翔云提供了身份证识别接口、身份证实名认证接口、护照识别接口,身份证识别接口自动提取身份证信息、身份证实名认证接口实时联网查验身份证的真伪。
以身份证识别接口Java语言代码为例,欢迎免费体验:
package com.test;
import okhttp3.;
import org.json.JSONObject;
import java.io.;
/**
- 需要添加依赖
-
com.squareup.okhttp3
-
okhttp
-
4.12.0
*/
class Sample {
static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build();
public static void main(String []args) throws IOException{
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("img","/9j")
.addFormDataPart("key","M***********g")
.addFormDataPart("secret","3***********6")
.addFormDataPart("typeId","2")
.addFormDataPart("format","json")
.build();
Request request = new Request.Builder()
.url("https://netocr.com/api/recogliu.do")
.method("POST", body)
.build();
Response response = HTTP_CLIENT.newCall(request).execute();
System.out.println(response.body().string());
}
}
标签:Java,addFormDataPart,接口,实名,身份证,识别,build From: https://www.cnblogs.com/netocr/p/18082833