今天我们进行相同图的比较
同样出了岔子,每走一步都出岔子
public static String SelfieAnime(byte[] file,String savePath,String suffixName) { // 请求url String url = "https://aip.baidubce.com/rest/2.0/image-process/v1/selfie_anime"; try { byte[] imgData = file; String imgStr = Base64Util.encode(imgData); String imgParam = URLEncoder.encode(imgStr, "UTF-8"); String param = "image=" + imgParam; String accessToken = AuthService.getAuth("uRN0ZNQEXgoKHOEIWGDX1IQb","yeFNnQlK6RVKGcNXb0RaaCeZVGL63DBo"); JSONObject jsonObject=JSON.parseObject(HttpUtil.post(url, accessToken, param)); String result=jsonObject.getString("image"); if (result.equals("")){ return "result is null"; } BASE64Decoder decoder = new BASE64Decoder(); OutputStream out = new FileOutputStream(savePath+jsonObject.getString("log_id")+"."+suffixName); out.write(Base64Util.decode(decoder.decodeBuffer(result))); out.flush(); out.close(); return jsonObject.getString("log_id"); } catch (Exception e) { e.printStackTrace(); return "error:e.printStackTrace()"; } }