private void loadImage(string filename) { if (!string.IsNullOrEmpty(filename)) { FaceClient client = new FaceClient("8c1be718fa976083a6940009f36c056e"); byte[] bt = Common.GetFilebyte(filename); //var face = client.FaceDetect(bt);//获取特征值 var face = client.FaceDetectAgeAndSex(bt); picSource.Image = Image.FromStream(new MemoryStream(bt)); if (face != null && face.facemodels.Count > 0) { Image img = Image.FromStream(new MemoryStream(bt)); foreach (var model in face.facemodels) { img = Common.DrawImage(img, model.facerectanglex, model.facerectangley, model.facerectanglewidth, model.facerectangleheight); } picCheck.Image = img; } else { MessageBox.Show("未读取到人脸信息"); } } }