Example #1
0
        public InfoPage(string filename)
        {
            InitializeComponent();

            this.filename     = filename;
            faceServiceClient = new FaceServiceClient(SmileFace.Helpers.Constants.FaceApiKey, SmileFace.Helpers.Constants.FaceEndpoint);
        }
Example #2
0
 public MainViewModel(IFaceServiceClient client, IDialogService dialogService)
 {
     Sections = new List <SectionViewModel>
     {
         new SectionViewModel
         {
             Name      = "Detect",
             ViewModel = new DetectViewModel(client, dialogService)
         },
         new SectionViewModel
         {
             Name      = "Identify",
             ViewModel = new IdentifyViewModel(client, dialogService)
         },
         new SectionViewModel
         {
             Name      = "Group",
             ViewModel = new GroupViewModel(client, dialogService)
         },
         new SectionViewModel
         {
             Name      = "Registered People",
             ViewModel = new RegisterViewModel(client, dialogService, DefaultValues.DefaultGroupName)
         }
     };
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:XamarinCognitiveServices.ViewModels.FaceApiViewModel"/> class.
 /// </summary>
 public FaceApiViewModel()
 {
     _faceServiceClient = new FaceServiceClient(Constants.FaceApiKey, Constants.FaceEndpoint);
     TakePhotoCommand   = new Command(OnTakePhoto);
     ImportPhotoCommand = new Command(OnImportPhoto);
     IsBusy             = false;
 }
 public FaceMetaData(string facekey, string emotionKey)
 {
     _seenAlready = new List <Guid>();
     // Initialize the face service client
     _faceServiceClient    = new FaceServiceClient(facekey);
     _emotionServiceClient = new EmotionServiceClient(emotionKey);
 }
        public CognitiveService()
        {
            var url = WebConfigurationManager.AppSettings["CognitiveServiciesUrl"];
            var key = WebConfigurationManager.AppSettings["CognitiveServicesFaceApiKey"];

            _client = new FaceServiceClient(key, url);
        }
        public RegisterViewModel(IFaceServiceClient client, IDialogService dialogService, string group)
        {
            this.client = client;
            this.group  = group;
            var fileSelector = new ObservableFileSelector();

            SelectImagesCommand = fileSelector.SelectFilesCommand;
            var imageSelector = new ImageSelector(fileSelector.SelectFilesCommand);

            imagesHelper = imageSelector.Images.ToProperty(this, r => r.Images);

            LoadPeopleCommand = ReactiveCommand.CreateFromTask(LoadPeople);
            LoadPeopleCommand.HandleErrors(dialogService);
            var canRegister = this
                              .WhenAnyValue(x => x.Name, x => x.Images, (name, images) => new { name, images })
                              .Select(x => !string.IsNullOrEmpty(x.name) && x.images != null && x.images.Any());

            RegisterPersonCommand = ReactiveCommand.CreateFromTask(RegisterPerson, canRegister);
            RegisterPersonCommand.HandleErrors(dialogService);

            peopleHelper = LoadPeopleCommand.Select(people => people.Select(person => new PersonViewModel(person, client, group, dialogService)).ToList()).ToProperty(this, r => r.People);

            busyObs = Observable
                      .Merge(new [] { RegisterPersonCommand.IsExecuting, LoadPeopleCommand.IsExecuting })
                      .ToProperty(this, model => model.IsBusy);

            MessageBus.Current.Listen <PersonDeletedMessage>()
            .Select(x => Unit.Default)
            .InvokeCommand(this, model => model.LoadPeopleCommand);

            RegisterPersonCommand
            .Select(x => Unit.Default)
            .InvokeCommand(LoadPeopleCommand);
        }
        public ReconhecimentoService()
        {
            string key = WebConfigurationManager.AppSettings["AZURE_subscriptionKey"];
            string url = WebConfigurationManager.AppSettings["AZURE_apiRoot"];

            _faceServiceCliente = new FaceServiceClient(key, url);
        }
Example #8
0
 public ImageAnalyzer()
 {
     configManager = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
     confCollection = configManager.AppSettings.Settings;
     string keyId = confCollection["FaceAPIKey"].Value;
     faceDetector = new FaceServiceClient(keyId);
 }
Example #9
0
        public CognitiveService(ISecretKeyProvider secretKeyProvider, string vaultName) :
            base(secretKeyProvider, vaultName)
        {
            _faceClient = new FaceServiceClient(GetSecretValue("FaceKey"), GetSecretValue("FaceUrl"));

            _visionServiceClient = new VisionServiceClient(GetSecretValue("VisionKey"), GetSecretValue("VisionUrl"));
        }
Example #10
0
        /// <summary>
        /// CRUD operations for local groups storage
        /// </summary>
        public LocalDbGroupsWindow()
        {
            InitializeComponent();

            // settings
            this.settingsReader = new AppSettingsReader();

            // API
            this.api_key           = this.settingsReader.GetValue("api_key", typeof(string)).ToString();
            this.api_url           = this.settingsReader.GetValue("api_url", typeof(string)).ToString();
            this.faceServiceClient = new FaceServiceClient(api_key, api_url);

            // database
            connstr          = new MySqlConnectionStringBuilder();
            connstr.Server   = settingsReader.GetValue("db_server", typeof(string)).ToString();
            connstr.UserID   = settingsReader.GetValue("db_user", typeof(string)).ToString();
            connstr.Password = settingsReader.GetValue("db_password", typeof(string)).ToString();
            connstr.Database = settingsReader.GetValue("db_db", typeof(string)).ToString();

            dbFactory = new OrmLiteConnectionFactory(connstr.ToString(), MySqlDialect.Provider);

            DataTable result = LoadGroupsData();

            GridGroupModel.ItemsSource = result.DefaultView;
        }
Example #11
0
        public DetectViewModel(IFaceServiceClient client, IDialogService dialogService)
        {
            var fileSelector  = new ObservableFileSelector();
            var imageSelector = new ImageSelector(fileSelector.SelectFilesCommand);

            detector = new Detector(client);


            SelectFilesCommand = fileSelector.SelectFilesCommand;

            var selectFilesObs = SelectFilesCommand.Publish();

            DetectCommand = ReactiveCommand.CreateFromTask(DetectFaces, imageSelector.Images.Any());

            imagesHelper = imageSelector.Images
                           .Select(list => list.Select(data => new DetectionViewModel(data.Image, data.Source)).ToList())
                           .ToProperty(this, model => model.Images);

            DetectCommand.Subscribe(detections => SetDetections(detections));
            DetectCommand.ThrownExceptions.Subscribe(async exception => await dialogService.ShowException(exception));

            loadingHelper = DetectCommand.IsExecuting.ToProperty(this, model => model.IsBusy);

            selectFilesObs.Connect();
        }
Example #12
0
 public VolonteerViewModel(IFaceServiceClient faceServiceClient) : base(faceServiceClient)
 {
     Title = "Persons";
     AnalizeFaceCommand     = new Command(AnalizeFace);
     FindSimilarFaceCommand = new Command(FindSimilarFace);
     OutputString           = string.Empty;
 }
        public IdentifyViewModel(IFaceServiceClient client, IDialogService dialogService)
        {
            this.client = client;
            var fileSelector  = new ObservableFileSelector();
            var imageSelector = new ImageSelector(fileSelector.SelectFilesCommand);

            detector = new Detector(client);

            SelectFilesCommand = fileSelector.SelectFilesCommand;

            var filesObs = SelectFilesCommand.Publish();

            IdentifyCommand = ReactiveCommand.CreateFromTask(IdentifyFaces, imageSelector.Images.Any());

            imagesObs = imageSelector.Images
                        .Select(list => list.Select(data => new IdentificationViewModel(data.Image, data.Source)).ToList())
                        .ToProperty(this, model => model.Identifications);

            IdentifyCommand.Subscribe(SetIdentifications);
            IdentifyCommand.ThrownExceptions.Subscribe(async exception => await dialogService.ShowException(exception));

            isBusyObs = IdentifyCommand.IsExecuting.ToProperty(this, model => model.IsBusy);

            filesObs.Connect();
        }
Example #14
0
        public FaceAPIClient()
        {
            // ToDo: initialize faceServiceClient object here...
            var subscriptionKey = ConfigurationManager.AppSettings["FaceApiSubscriptionKey"];
            var endpoint        = ConfigurationManager.AppSettings["FaceApiEndpoint"];

            faceServiceClient = new FaceServiceClient(subscriptionKey, endpoint);
        }
 public MicrosoftFaceDetection()
 {
     if (Config.MicrosoftFaceSubscriptionKey == string.Empty)
     {
         throw new Exception("Microsoft Face subscription key is empty.");
     }
     faceServiceClient = new FaceServiceClient(Config.MicrosoftFaceSubscriptionKey);
 }
        public MainPage()
        {
            InitializeComponent();

            //Initialize connection with API
            _faceServiceClientDetect = new FaceServiceClient(key, uriFaceDetect);
            _faceServiceClientVerify = new FaceServiceClient(key, uriFaceVerify);
        }
Example #17
0
 public MainPage()
 {
     InitializeComponent();
     // Provides access to the Face APIs
     this.faceServiceClient = new FaceServiceClient("6d46a7187eec4cc8a57ae04af12bf41f ");
     // Provides access to the Emotion APIs
     this.emotionServiceClient = new EmotionServiceClient("5abd2e5041464ab4bfcd46490afedb70");
 }
Example #18
0
        public programme()
        {
            personGroupId = "me2";
            //faceServiceClient = new FaceServiceClient("94dcb6a56f284ceb9c8b89db34614cbc");
            //faceServiceClient = new FaceServiceClient(KEY);

            faceServiceClient = new FaceServiceClient("cdaa051499427c9db2f7820a02fffd");
        }
        public ImageAnalyzer()
        {
            configManager  = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            confCollection = configManager.AppSettings.Settings;
            string keyId = confCollection["FaceAPIKey"].Value;

            faceDetector = new FaceServiceClient(keyId);
        }
Example #20
0
        public PersonService(UnitOfWork unit)
        {
            _faceServiceClient    = new FaceServiceClient(Global.OxfordFaceApiKey);
            _emotionServiceClient = new EmotionServiceClient(Global.OxfordEmotionApiKey);
            _unit = unit;

            Directory.CreateDirectory(MapPath(Global.TemporaryUploadsFolder));
        }
        public ProjectOxford()
        {
            var appSettings = ResourceLoader.GetForViewIndependentUse("AppSettings");

            visionClient  = new VisionServiceClient(appSettings.GetString("VISION_API_KEY"));
            faceClient    = new FaceServiceClient(appSettings.GetString("FACE_API_KEY"));
            emotionClient = new EmotionServiceClient(appSettings.GetString("EMOTION_API_KEY"));
        }
Example #22
0
        private async void Form1_Load(object sender, EventArgs e)
        {
#if USE_OPENCV
            faceServiceClient = null;
#else
            try
            {
                using (StreamReader configFile = new StreamReader("./FaceAPI.config"))
                {
                    apiKey = configFile.ReadLine();
                    url    = configFile.ReadLine();
                    configFile.Close();
                }
            }
            catch (FileNotFoundException)
            {
                ConfigForm configForm = new ConfigForm();
                configForm.configRequired = true;
                DialogResult result = configForm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    apiKey = configForm.GetApiKey();
                    url    = configForm.GetURL();

                    if (apiKey == "" || url == "")
                    {
                        return;
                    }
                    using (StreamWriter configFile = new StreamWriter("./FaceApi.config"))
                    {
                        configFile.WriteLine(apiKey);
                        configFile.WriteLine(url);
                        configFile.Close();
                    }
                }
            }

            faceServiceClient = new FaceServiceClient(apiKey, url);
#endif
            personGroups = await GetPersonGroups();

            foreach (PersonGroup personGroup in personGroups)
            {
                personGroupSelector.Items.Add(personGroup.Name);
            }

            personSelector.Enabled          = false;
            addFromFileButton.Enabled       = false;
            deletePersonGroupButton.Enabled = false;
            deletePersonButton.Enabled      = false;
            deleteFacesButton.Enabled       = false;
            addPersonGroupButton.Enabled    = false;
            addPersonButton.Enabled         = false;
            identifyButton.Enabled          = false;
            nextButton.Enabled  = false;
            prevButton.Enabled  = false;
            trainButton.Enabled = false;
        }
Example #23
0
        public Gallery()
        {
            faceClient = new FaceServiceClient(Constants.APIkey, Constants.APIUri);

            miniatureGenerator = new MiniatureGenerator();
            InitializeComponent();
            ScrollViewMiniatures.ScrollChanged += ScrollViewMiniatures_ScrollChanged;
            Loaded += Gallery_Loaded;
        }
Example #24
0
 // DavidLim :
 // MSCognitiveServicesLogin_Click() is the handler for the Click event of the
 // button named MSCognitiveServicesLogin in the xaml.
 // This handler responds by instantiating a new FaceServiceClient class based
 // on the FaceAPI key supplied in the FaceRecogKey TextBox.
 private void MSCognitiveServicesLogin_Click(object sender, RoutedEventArgs e)
 {
     faceServiceClient = new FaceServiceClient(FaceRecogKey.Text, "https://westcentralus.api.cognitive.microsoft.com/face/v1.0");
     if (faceServiceClient != null)
     {
         FaceRecogKey.Text = "";
         MSCognitiveServicesLogin.IsEnabled = false;
     }
 }
        public MainPage()
        {
            InitializeComponent();

            _faceServiceClient = new FaceServiceClient("a7cff5bb619b4b3e8df3dd14eefcb57c", "https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect");

            list = new ObservableCollection <Face>();
            FacesListView.ItemsSource = list;
        }
Example #26
0
        public MainPage()
        {
            InitializeComponent();

            _faceServiceClient = new FaceServiceClient("KEY",
                                                       "URL");

            list = new ObservableCollection <Face>();
            FacesListView.ItemsSource = list;
        }
        double resizeFactor;            // The resize factor for the displayed image.

        public MainWindow()
        {
            InitializeComponent();

            faceServiceClient = new FaceServiceClient(
                ConfigurationManager.AppSettings["subscriptionKey"],
                ConfigurationManager.AppSettings["apiRoot"]);

            SetImage(Properties.Settings.Default.ImagePath);
        }
Example #28
0
        public MainPage()
        {
            InitializeComponent();

            _faceServiceClient = new FaceServiceClient("KEY", "URL");

            faceId1  = new Guid();
            faceId2  = new Guid();
            personId = new Guid("PERSONID");
        }
Example #29
0
        public MainPage()
        {
            InitializeComponent();

            _faceServiceClient = new FaceServiceClient("1f940d1adfeb4d70992e9284588c76fe",
                                                       "https://southeastasia.api.cognitive.microsoft.com/face/v1.0");

            list = new ObservableCollection <Face>();
            FacesListView.ItemsSource = list;
        }
Example #30
0
        public PersonViewModel(Person person, IFaceServiceClient client, string group, IDialogService dialogService)
        {
            Person        = person;
            DeleteCommand = ReactiveCommand.CreateFromTask(async() =>
            {
                await client.DeletePersonAsync(@group, person.PersonId);
                await client.TrainPersonGroupAsync(DefaultValues.DefaultGroupName);
                MessageBus.Current.SendMessage(new PersonDeletedMessage(person));
            });

            DeleteCommand.HandleErrors(dialogService);
        }
        public MainPage()
        {
            InitializeComponent();

            var assembly = typeof(App).GetTypeInfo().Assembly;
            var cm       = new ConfigurationManager(assembly.GetManifestResourceStream("FaceEmotionRecognition.api-keys.config"));

            // Provides access to the Face APIs
            this.faceServiceClient = new FaceServiceClient(cm.GetAppSetting("FaceServiceClientAPIKey"));
            // Provides access to the Emotion APIs
            this.emotionServiceClient = new EmotionServiceClient(cm.GetAppSetting("EmotionServiceClientAPIKey"));
        }
 /// <summary>
 /// Constructor
 /// Initial Face Api client
 /// </summary>
 private FaceApiRecognizer() {
     _faceApiClient = new FaceServiceClient(GeneralConstants.OxfordAPIKey);
 }
Example #33
0
 public FaceAPI(string _apiKey)
 {
     faceServiceClient = new FaceServiceClient(_apiKey);
 }