public async Task <ActionResult> StartRecognition() { try { string containerName = _accountService.GetContainerNameResults(ClaimsPrincipal.Current); await _imagesService.DeleteAllImages(containerName); var patternImageUri = _imagesService.GetAllPhotos(_accountService.GetContainerNameFace(ClaimsPrincipal.Current)).Result.FirstOrDefault(); var patternImage = await _recognitionService.DetectFaces(patternImageUri.AbsoluteUri); var allImagesUri = await _imagesService.GetAllPhotos(_accountService.GetContainerNamePhotos(ClaimsPrincipal.Current)); var allImagesAddresses = allImagesUri.Select(e => e.AbsoluteUri); var allDetectedImages = await DetectionForImages(allImagesAddresses); var foundImages = await _recognitionService.FindSimilar(patternImage.Faces.FirstOrDefault().FaceId, allDetectedImages); await MoveToResultContainer(foundImages); return(RedirectToAction("Index", "Results")); } catch (Exception e) { return(View("Error")); } }
/// <summary> /// Uploads the photos. /// </summary> /// <returns></returns> public async Task <ActionResult> UploadPhotos() { try { ICollection <Uri> allPhotos = await _imagesService.GetAllPhotos(_accountService.GetContainerNamePhotos(ClaimsPrincipal.Current)); return(View(allPhotos)); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }