结果运行的非常成功
package test2;
import com.baidu.aip.imageclassify.AipImageClassify;
import com.baidu.aip.ocr.AipOcr;
import org.json.JSONObject;
import java.util.HashMap;
public class test2 {
//设置APPID/AK/SK
public static final String APP_ID = "25092090";
public static final String API_KEY = "HB6xiOxsGmZmS8fPdUtF7fWW";
public static final String SECRET_KEY = "v0nSNiAv5mB6fjGgnUbn0oswxfvIFF0B";
public static void main(String[] args) {
// 初始化一个AipOcr
AipOcr client = new AipOcr(APP_ID, API_KEY, SECRET_KEY);
// 传入可选参数调用接口
HashMap<String, String> options = new HashMap<String, String>();
options.put("detect_direction", "true");
options.put("detect_risk", "false");
String idCardSide = "back";
// 参数为本地图片路径
String image = "C:\\Users\\杜子轩\\Desktop\\身份证.jpg";
JSONObject res = client.idcard(image, idCardSide, options);
System.out.println(res.toString(2));
}
}