/// <summary> /// 人脸查找 /// </summary> private bool FaceSearch() { try { faceSearch = null; var jObject = face.Search(imageBase64, "BASE64", Globals.FaceGroupId); var error_code = int.Parse(jObject["error_code"].ToString()); if (error_code > 0) { faceSearch = null; return(false); } else { var result = jObject["result"]; faceSearch = JsonConvert.DeserializeObject <FaceSearchResultModel>(result.ToString()); foreach (var item in faceSearch.user_list) { if (item.score >= 80) { return(true); } } faceSearch = null; return(false); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 人脸检测 /// </summary> private void FaceDetect() { Dictionary <string, object> options = new Dictionary <string, object>(); //options["face_field"] = "age,beauty,expression,faceshape,gender,glasses,landmark,race,quality,facetype"; // var imageBase64 = Common.BitmapToBase64(bitmap); var jObject = face.Detect(imageBase64, "BASE64", options); var error_code = int.Parse(jObject["error_code"].ToString()); if (error_code > 0) { faceSearch = null; } else { var result = jObject["result"]; faceDetect = JsonConvert.DeserializeObject <FaceDetectResultModel>(result.ToString()); } }