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")); } }
public async Task <ActionResult> UploadAsyncFace() { try { HttpFileCollectionBase files = Request.Files; string containerName = _accountService.GetContainerNameFace(ClaimsPrincipal.Current); await _imagesService.DeleteAllImages(containerName); await _imagesService.UploadAsync(files, containerName); return(RedirectToAction("UploadFace")); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }
public async Task <ActionResult> DeleteAll() { try { await _imagesService.DeleteAllImages(_accountService.GetContainerNameResults(ClaimsPrincipal.Current)); return(RedirectToAction("Index")); } catch (Exception ex) { ViewData["message"] = ex.Message; ViewData["trace"] = ex.StackTrace; return(View("Error")); } }