Exemple #1
0
        /// <summary>
        /// This method validate the image through the api with Face Recognition
        /// </summary>
        /// <param name="idSavedImage"></param>
        /// <returns></returns>
        public async Task <string> validateFaceRecognition(int idSavedImage)
        {
            string objectId;
            bool   validation     = false;
            string _ResultService = "";
            ObjectResultRecognition resultRecognition = new ObjectResultRecognition();

            try
            {
                //using to recognition
                _ResultService = await WRequest(urlRecognitionGroup + idSavedImage, "get", "");

                resultRecognition = JsonConvert.DeserializeObject <ObjectResultRecognition>(_ResultService);
                if (resultRecognition.Success)
                {
                    objectId = resultRecognition.ObjectId;
                }
                else
                {
                    objectId = "not found";
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(objectId);
        }
Exemple #2
0
        public async Task <int> enqueueCustomer(string objectId, string idPhoto, string name, string fileName)
        {
            bool   validation = false;
            int    caseId;
            string _ResultService = "";
            ObjectResultRecognition resultRecognition = new ObjectResultRecognition();

            try
            {
                StringBuilder url = new StringBuilder();
                url.Append(urlEnqueue + objectId);
                url.Append("&idPhoto=" + idPhoto);
                url.Append("&name=" + name);
                url.Append("&fileName=" + fileName);

                //using to recognition
                _ResultService = await WRequest(url.ToString(), "get", "");

                caseId = Convert.ToInt32(_ResultService);
            }
            catch (Exception)
            {
                throw;
            }
            return(caseId);
        }
Exemple #3
0
        /// <summary>
        /// This method upload an image to the group o Face Recognition, in this case TestNavy
        /// </summary>
        /// <param name="name">Name of  the user</param>
        /// <param name="lastName"></param>
        /// <param name="phoneNumber"></param>
        /// <param name="imageName"></param>
        /// <param name="idSavedImage"></param>
        /// <returns></returns>
        public async Task <bool> uploadImage(string name, string lastName, string phoneNumber, string imageName, int idSavedImage)
        {
            bool   uploaded       = false;
            string _ResultService = "";
            ObjectResultRecognition resultRecognition = new ObjectResultRecognition();

            try
            {
                //using to upload image
                //string _ObjectId = "FirstName_LastName_PhoneNumber";
                string _ObjectId = Utilities.Util.generateObjectId(name, lastName, phoneNumber);
                string _ImageId  = Utilities.Util.generateImageId(imageName);
                //string _ImageId = "mayra-3";
                string urlUploadImage = _BaseUrl + "/api/FaceRecognition/UploadImage?IdPhoto="
                                        + idSavedImage.ToString() + "&ObjectId=" + _ObjectId + "&ImageId=" + _ImageId;
                _ResultService = await WRequest(urlUploadImage, "get", "");

                if (resultRecognition.Success)
                {
                    uploaded = true;
                }
                else
                {
                    uploaded = false;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(uploaded);
        }