人脸搜索求助m:n
s17810645353 发布于2018-10 浏览:1138 回复:1
0
收藏
快速回复

public class FaceMultiSearch {
public static void main(String[] args) throws IOException {
String FilePath = "F:\\test02.jpg";
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat mat = Imgcodecs.imread(FilePath);
ImageViewer imageViewer = new ImageViewer(mat, "参与对比的图片");
imageViewer.imshow();
FaceMultiSearch.mutilSearch(FilePath);
}

 

public static String mutilSearch(String FilePath) throws IOException {

String url = "https://aip.baidubce.com/rest/2.0/face/v3/multi-search";
String imgPath = Base64Util.GetImageStrFromPath(FilePath);

 

try {
Map map = new HashMap<>();

map.put("image",imgPath);
// System.out.println(URLEncoder.encode(imgPath));
map.put("image_type", "BASE64");
map.put("liveness_control", "NORMAL");
map.put("group_id_list", "group_repeat");
map.put("max_face_num", 5);
map.put("quality_control", "LOW");
String param = GsonUtils.toJson(map);


// 注意这里仅为了简化编码每一次请求都去获取access_token,线上环境access_token有过期时间, 客户端可自行缓存,过期后重新获取。
String accessToken = "24.0744b379aeae8cbb765930838d6e5099.2592000.1542337241.282335-14436504";
String result = HttpUtil.post(url, accessToken, "application/json", param);
System.out.println(result);
return result;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

收藏
点赞
0
个赞
共1条回复 最后由我是小丸子774回复于2018-11
#2我是小丸子774回复于2018-11

你的问题是什么

0
TOP
切换版块