private void ButtonDrawContours_Click(object sender, RoutedEventArgs e) { if (inputSoftwareBitmap != null) { processedImage = inputSoftwareBitmap.ToWriteableBitmap(); OpenCvWrapper.DetectObjects(processedImage, true); OnPropertyChanged("ProcessedImage"); } }
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); } }