private async Task BeginDetection(DetectionDataParametersModel detectionDataParameters)
        {
            if (detectionDataParameters == null)
            {
                return;
            }

            UpdateProgressRingAndResultsVisibility(true);

            // Your code goes here

            var classLabel = "surface-pro";

            await ShowResults(detectionDataParameters.SelectedFile, classLabel);
        }
        private async void OnTakePhotoClick(object sender, RoutedEventArgs e)
        {
            var capture = new CameraCaptureUI();

            capture.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
            capture.PhotoSettings.CroppedSizeInPixels = new Size(500, 500);

            var photo = await capture.CaptureFileAsync(CameraCaptureUIMode.Photo);

            if (photo != null)
            {
                var parameters = new DetectionDataParametersModel {
                    SelectedFile = photo
                };
                Frame.Navigate(typeof(DevicesPage), parameters);
            }
        }
Exemple #3
0
        private async Task BeginDetection(DetectionDataParametersModel detectionDataParameters)
        {
            if (detectionDataParameters == null)
            {
                return;
            }

            UpdateProgressRingAndResultsVisibility(true);

            // Your code goes here
            ContosoITModelInput modelInput = new ContosoITModelInput()
            {
                data = await ImageToVideoframe(detectionDataParameters.SelectedFile)
            };
            ContosoITModelOutput modelResult = await model.EvaluateAsync(modelInput);

            var classLabel = modelResult.classLabel.FirstOrDefault();

            await ShowResults(detectionDataParameters.SelectedFile, classLabel);
        }
        private async void OnAttachImageClick(object sender, RoutedEventArgs e)
        {
            var picker = new FileOpenPicker
            {
                ViewMode = PickerViewMode.Thumbnail,
                SuggestedStartLocation = PickerLocationId.PicturesLibrary
            };

            picker.FileTypeFilter.Add(".jpg");
            picker.FileTypeFilter.Add(".jpeg");
            picker.FileTypeFilter.Add(".png");

            var file = await picker.PickSingleFileAsync();

            if (file != null)
            {
                var parameters = new DetectionDataParametersModel {
                    SelectedFile = file
                };
                Frame.Navigate(typeof(DevicesPage), parameters);
            }
        }