private void OnDownloadComplete(object sender, AsyncCompletedEventArgs e) { try { using (var imageTensor = ImageIO.ReadTensorFromImageFile <float>(_fileName, 224, 224, 128.0f, 1.0f / 128.0f)) { var detectionResult = _graph.Detect(imageTensor); var detectionAnnotations = MultiboxGraph.FilterResults(detectionResult, 0.1f); var detectionImage = NativeImageIO.ImageFileToJpeg(_fileName, detectionAnnotations); var typeConverter = TypeDescriptor.GetConverter(typeof(Bitmap)); var detectionBmpImage = (Bitmap)typeConverter.ConvertFrom(detectionImage.Raw); ImageSource = BitmapConverter.ConvertBitmap(detectionBmpImage); } IsModalVisible = false; } catch (Exception ex) { _exceptionLogDataAccess.LogException(ex.ToString()); IsModalVisible = false; } }
public PeopleDetectionViewModel(ExceptionLogDataAccess exceptionLogDataAccess) { ConfigureHeaderControl(true, true, Properties.PeopleDetectionResource.Title); ImageSource = BitmapConverter.ConvertBitmap(Properties.Resources.ImagePlaceholder); _exceptionLogDataAccess = exceptionLogDataAccess; }