public async Task <FCResult> Auth() { _Client = new FCClient(_ApiKey, _ApiSecret); FCResult result = await _Client.Account.AuthenticateAsync(); return(result); }
/// <summary> /// Sendet das Bild an den Rest Service und speichert das Ergebnis. /// </summary> private void CalculateGender(String path) { Stream stream = System.IO.File.OpenRead(path); _result = _client.Faces.EndDetect(_client.Faces.BeginDetect(null, new Stream[] { stream }, Detector.Normal, Attributes.All, null, null)); stream.Close(); }
public IEnumerable <string> Recognize(string path) { IEnumerable <string> users = new List <string>() { "all@" + _Namespace }; Stream pic = File.OpenRead(path); FCResult faceRecognition = _Client.Faces.RecognizeAsync(users, null, new[] { pic }, _Namespace, Detector.Default, Attributes.Default, null).Result; var recognizedNames = new List <string>(); if (faceRecognition.Photos.Any() && faceRecognition.Photos[0].Tags.Any()) { recognizedNames.AddRange( from tag in faceRecognition.Photos[0].Tags select tag.Matches.FirstOrDefault() into match where match != null && match.Confidence > 50 select match.UserId.Split('@')[0]); } return(recognizedNames); }
/// <summary> /// Initialisiert den Rest Service. /// </summary> private void InitializeService() { _client = new FCClient("5f228f0a0ce14e86a7c901f62ca5a569", "1231e9f2e95d4d90adf436e3de20f0f6"); _result = _client.Account.EndAuthenticate(_client.Account.BeginAuthenticate(null, null)); }