/// <summary>人脸检测</summary> public string FaceDect(byte[] bytes) { string result = string.Empty; try { result = Youtu.detectface(bytes); } catch (System.Exception e) { Debug.LogError(e.Message); } return(result); }
private void btn_detectface_Click(object sender, EventArgs e) { string path = System.IO.Directory.GetCurrentDirectory() + "\\test.jpg"; string result = Youtu.detectface(path); detectfaceResponse faceshape = JsonHelper <detectfaceResponse> .ToEntity(result); if (faceshape.errorcode == 0) { string dis = ""; System.Reflection.PropertyInfo[] properties = faceshape.face[0].GetType().GetProperties(); foreach (System.Reflection.PropertyInfo prop in properties) { dis += prop.Name + ":" + prop.GetValue(faceshape.face[0], null).ToString() + "\n"; } MessageBox.Show(dis, "检测结果"); } }