人脸比对接口调试
parent
6e3ab2612c
commit
f3ebd4656c
|
@ -160,14 +160,31 @@ public class CompareServiceImpl implements ICompareService {
|
||||||
private void validateSingleFaceImage(String image) {
|
private void validateSingleFaceImage(String image) {
|
||||||
//人脸检测url
|
//人脸检测url
|
||||||
//String faceSearchUrl = apiRequestPrefix + ApiUrlEnum.FACE_SEARCH.getUrl();
|
//String faceSearchUrl = apiRequestPrefix + ApiUrlEnum.FACE_SEARCH.getUrl();
|
||||||
String faceSearchUrltest = 192.168.3.132:5000/message/mask;
|
|
||||||
|
String faceSearchUrltest ="http://192.168.3.132:5000/message/mask";
|
||||||
//组装api请求数据
|
//组装api请求数据
|
||||||
ReturnVO returnVO;
|
ReturnVO returnVO;
|
||||||
returnVO = (ReturnVO) httpUtil.post(faceSearchUrltest + "?url=" + image, null, ReturnVO.class);
|
returnVO = (ReturnVO) httpUtil.post(faceSearchUrltest + "?url=" + image, null, ReturnVO.class);
|
||||||
|
System.out.println(returnVO.getCode()+returnVO.getMessage());
|
||||||
if (returnVO.getCode() != 200) {
|
if (returnVO.getCode() != 200) {
|
||||||
throw new DkException(returnVO.getMessage());
|
throw new DkException(returnVO.getMessage());
|
||||||
}
|
}
|
||||||
//反序列化
|
//反序列化
|
||||||
|
// 返回data格式{
|
||||||
|
// "code": 200,
|
||||||
|
// "data": [
|
||||||
|
// {
|
||||||
|
// "faceRect": {
|
||||||
|
// "h": 174,
|
||||||
|
// "w": 257,
|
||||||
|
// "x": 161,
|
||||||
|
// "y": 47
|
||||||
|
// },
|
||||||
|
// "url": "http://192.168.1.133:9000/middleware/456/1790226920.jpg"
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// "message": "检测到人脸"
|
||||||
|
//}
|
||||||
List<ApiSearchFaceRectVO> apiSearchFaceRectVOList = JsonUtil.string2Obj(JsonUtil.obj2String(returnVO.getData()), new TypeReference<List<ApiSearchFaceRectVO>>() {});
|
List<ApiSearchFaceRectVO> apiSearchFaceRectVOList = JsonUtil.string2Obj(JsonUtil.obj2String(returnVO.getData()), new TypeReference<List<ApiSearchFaceRectVO>>() {});
|
||||||
if (UtilValidate.isEmpty(apiSearchFaceRectVOList)) {
|
if (UtilValidate.isEmpty(apiSearchFaceRectVOList)) {
|
||||||
throw new DkException("当前上传中未检测到人脸,请重新上传");
|
throw new DkException("当前上传中未检测到人脸,请重新上传");
|
||||||
|
|
Loading…
Reference in New Issue