Good day to all. There is a need to work with images that are taken from the camera. The image from the camera is displayed in real time on the form. I do it through OpenCVSharp. Took the component VideoCapture. I did not find anything better how to display frames on Image.
$ Image DataContext = "{Binding ManagerProvider}" Source = "{Binding Image}"
The update takes place in an infinite loop.
public BitmapSource Image { get; set; } var _video = new VideoCapture(CaptureDevice.Any) Task.Factory.StartNew(startVideo); private void startVideo() { while (_isWork) { if (_video.Read(_mat)) { try { Application.Current.Dispatcher.BeginInvoke(new Action(() => { Image = _mat.ToWriteableBitmap(); })); } catch (Exception ex) { ex.Error(); } } } } But all this design wildly loads percents, besides the picture sometimes blinks. Tell me, maybe there is another way to display video in real time? While the webcam is working, maybe an ip camera will appear soon