Esempio n. 1
0
 private void OnFrameReceived(object sender, IDecodedVideoFrame decodedFrame)
 {
     if (!decodedFrame.FrameParameters.Equals(_frameParameters))
     {
         _frameParameters     = decodedFrame.FrameParameters;
         _transformParameters = new TransformParameters(System.Drawing.RectangleF.Empty,
                                                        new System.Drawing.Size(_frameParameters.Width, _frameParameters.Height),
                                                        ScalingPolicy.Stretch, PixelFormat.Bgr24, ScalingQuality.FastBilinear);
         _cvBitmap = new Image <Bgr, byte>(_frameParameters.Width, _frameParameters.Height);
         FrameSizeChanged?.Invoke(this, new Tuple <double, double>(_frameParameters.Width, _frameParameters.Height));
     }
     if (_yoloWrapper.IsYoloReady())
     {
         decodedFrame.TransformTo(_cvBitmap.Mat.DataPointer, _cvBitmap.Mat.Cols * _cvBitmap.Mat.ElementSize, _transformParameters);
         _yoloWrapper.FrameIn(this, _cvBitmap.Mat);
     }
 }