Example #1
0
        private async Task <AddPersistedFaceResult> AddFaceToFaceList(string faceListId, Stream imageAsStream)
        {
            try
            {
                var faceResult = await _faceServiceClient.AddFaceToFaceListAsync(faceListId, imageAsStream);

                if (faceResult == null)
                {
                    throw new Exception("AddPersistedFaceResult is null");
                }
                return(faceResult);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return(new AddPersistedFaceResult());
            }
        }
Example #2
0
                public static async Task <Guid?> AddFaceToFaceList(string imageFilePath, string FaceId)
                {
                    try
                    {
                        using (Stream imageFileStream = File.OpenRead(imageFilePath))
                        {
                            var result = await faceServiceClient.AddFaceToFaceListAsync(faceList, imageFileStream, FaceId);

                            return(result.PersistedFaceId);
                        }
                    }
                    // Catch and display Face API errors.
                    catch (FaceAPIException f)
                    {
                        // MessageBox.Show(f.ErrorMessage, f.ErrorCode);
                        return(null);
                    }
                    // Catch and display all other errors.
                    catch (Exception e)
                    {
                        //MessageBox.Show(e.Message, "Error");
                        return(null);
                    }
                }
Example #3
0
 public Task <AddPersistedFaceResult> AddFaceToFaceListAsync(string faceListId, string imageUrl, string userData = null, FaceRectangle targetFace = null)
 {
     return(innerClient.AddFaceToFaceListAsync(faceListId, imageUrl, userData, targetFace));
 }