Beispiel #1
0
        public List <BoundingBox> DetectObjectsUsingModel(ImageInputData imageInputData)
        {
            var labels        = customVisionPredictionEngine?.Predict(imageInputData).PredictedLabels ?? tinyYoloPredictionEngine?.Predict(imageInputData).PredictedLabels;
            var boundingBoxes = outputParser.ParseOutputs(labels);
            var filteredBoxes = outputParser.FilterBoundingBoxes(boundingBoxes, 5, 0.5f);

            return(filteredBoxes);
        }
        public IList <YoloBoundingBox> DetectObjectsUsingModel(ImageInputData imageInputData)
        {
            var labels        = predictionEngine.Predict(imageInputData).PredictedLabels;
            var boundingBoxes = yoloParser.ParseOutputs(labels);
            var filteredBoxes = yoloParser.FilterBoundingBoxes(boundingBoxes, 5, 0.5f);

            return(filteredBoxes);
        }
        async Task ParseWebCamFrame(Bitmap bitmap)
        {
            if (predictionEngine == null)
            {
                return;
            }

            var frame = new ImageInputData {
                Image = bitmap
            };
            var filteredBoxes = DetectObjectsUsingModel(frame);

            await Application.Current.Dispatcher.InvokeAsync(() =>
            {
                DrawOverlays(filteredBoxes, (int)WebCamImage.ActualHeight, (int)WebCamImage.ActualWidth);
            });
        }
Beispiel #4
0
        async Task ParseWebCamFrame(Bitmap bitmap, CancellationToken token)
        {
            if (customVisionPredictionEngine == null && tinyYoloPredictionEngine == null)
            {
                return;
            }

            var frame = new ImageInputData {
                Image = bitmap
            };
            var filteredBoxes = DetectObjectsUsingModel(frame);

            if (!token.IsCancellationRequested)
            {
                await Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    DrawOverlays(filteredBoxes, WebCamImage.ActualHeight, WebCamImage.ActualWidth);
                });
            }
        }