/// <summary> /// Detects faces. /// </summary> /// <returns>An image path</returns> public async Task <string> Detect() { _detectedFaces = await FaceDetector.DetectAsync(_mvSource); _numberOfFaces = _detectedFaces.Length; return(_imagePath); }
public async Task <string> FaceDetection([FromBody] UploadCustomerImageModel model) { IEnumerable <FaceRectangle> faces = (await faceDetector.DetectAsync(model.ImageData)) .Select(face => new FaceRectangle { Height = face["height"], Left = face["left"], Top = face["top"], Width = face["width"], X1 = face["x1"], X2 = face["x2"], Y1 = face["y1"], Y2 = face["y2"] }); return(JsonConvert.SerializeObject(faces.Select(face => new FaceModel { FaceRectangle = face, FaceAttributes = new FaceAttributes() }))); }