/// <summary> /// Detect face and return the face id of a image file /// </summary> /// <param name="imageFile"> /// image file to detect face /// </param> /// <returns>face id</returns> private async Task <Guid[]> DetectFacesFromImage(StorageFile imageFile) { var stream = await imageFile.OpenStreamForReadAsync(); var faces = await _faceApiClient.DetectAsync(stream); if (faces == null || faces.Length < 1) { throw new FaceRecognitionException(FaceRecognitionExceptionType.NoFaceDetected); } return(FaceApiUtils.FacesToFaceIds(faces)); }