コード例 #1
0
        private void ButtonDrawContours_Click(object sender, RoutedEventArgs e)
        {
            if (inputSoftwareBitmap != null)
            {
                processedImage = inputSoftwareBitmap.ToWriteableBitmap();

                OpenCvWrapper.DetectObjects(processedImage, true);

                OnPropertyChanged("ProcessedImage");
            }
        }
コード例 #2
0
        private async Task <ObjectDescriptor> FindLargestObject(VideoFrame videoFrame)
        {
            if (Dispatcher.HasThreadAccess)
            {
                videoFrame.SoftwareBitmap.CopyToBuffer(workingBitmap.PixelBuffer);

                var objects = OpenCvWrapper.DetectObjects(workingBitmap, false);

                return(GetLargestObject(objects));
            }
            else
            {
                ObjectDescriptor objectDescriptor = null;

                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
                {
                    objectDescriptor = await FindLargestObject(videoFrame);
                });

                return(objectDescriptor);
            }
        }