private void VideoCapture1_OnVideoFrameBuffer(object sender, VideoFrameBufferEventArgs e) { try { if (tempBuffer == IntPtr.Zero) { tempBuffer = Marshal.AllocCoTaskMem(e.Width * e.Height * 3); } if (e.StartTime < fragmentDuration) { Marshal.Copy(e.Buffer, 0, tempBuffer, e.Buffer.Length); VFPSearch.Process(tempBuffer, e.Width, e.Height, e.Width * 3, e.StartTime, ref searchLiveData); } else { Dispatcher.BeginInvoke(new StopVideoDelegate(StopVideoDelegateMethod)); } } catch { } }
private void MediaPlayer1_OnVideoFrameBuffer(object sender, VideoFrameBufferEventArgs e) { ProcessFrame(e.Frame); }
private void VideoCapture1_OnVideoFrameBuffer(object sender, VideoFrameBufferEventArgs e) { ProcessFrame(e.Frame); }
private void VideoCapture1_OnVideoFrameBuffer(object sender, VideoFrameBufferEventArgs e) { try { if (_tempBuffer == IntPtr.Zero) { _tempBuffer = Marshal.AllocCoTaskMem(e.Frame.Stride * e.Frame.Height); } // live if (_searchLiveData == null) { _searchLiveData = new FingerprintLiveData((int)(_fragmentDuration / 1000), DateTime.Now); _fragmentCount++; } if (e.StartTime < _fragmentDuration * _fragmentCount) { ImageHelper.CopyMemory(_tempBuffer, e.Frame.Data, e.Frame.DataSize); // process frame to remove ignored areas if (_ignoredAreas.Count > 0) { foreach (var area in _ignoredAreas) { if (area.Right > e.Frame.Width || area.Bottom > e.Frame.Height) { continue; } MFP.FillColor(_tempBuffer, e.Frame.Width, e.Frame.Height, area, 0); } } VFPSearch.Process(_tempBuffer, e.Frame.Width, e.Frame.Height, e.Frame.Stride, e.StartTime, ref _searchLiveData.Data); } else { _fingerprintQueue.Enqueue(_searchLiveData); _searchLiveData = null; Dispatcher.BeginInvoke(new ProcessVideoDelegate(ProcessVideoDelegateMethod)); } // overlap if (e.StartTime < _fragmentDuration / 2) { return; } if (_searchLiveOverlapData == null) { _searchLiveOverlapData = new FingerprintLiveData((int)(_fragmentDuration / 1000), DateTime.Now); _overlapFragmentCount++; } if (e.StartTime < _fragmentDuration * _overlapFragmentCount + _fragmentDuration / 2) { ImageHelper.CopyMemory(_tempBuffer, e.Frame.Data, e.Frame.DataSize); VFPSearch.Process(_tempBuffer, e.Frame.Width, e.Frame.Height, e.Frame.Stride, e.StartTime, ref _searchLiveOverlapData.Data); } else { _fingerprintQueue.Enqueue(_searchLiveOverlapData); _searchLiveOverlapData = null; Dispatcher.BeginInvoke(new ProcessVideoDelegate(ProcessVideoDelegateMethod)); } } catch { } }
private static void VideoCapture_OnVideoFrameBuffer(object sender, VideoFrameBufferEventArgs e) { }