private void App_Frame(OpenCvSharp.Mat frame) { this.SourceFrameLock.WaitOne(); if (this.SourceFrame != null) { this.SourceFrame.Dispose(); } this.SourceFrame = frame; this.SourceFrameLock.ReleaseMutex(); this.ExecPython(this.OptionViewModel.Model.RenderScriptName, frame); this.Frame = BitmapExtension.Parse(frame); this._elapsedStopwatch.Stop(); this.ElapsedTime = this.ElapsedTime.Add(TimeSpan.FromMilliseconds(this._elapsedStopwatch.ElapsedMilliseconds)); this._elapsedStopwatch.Restart(); this._handleFrameThreadExecutableLock.WaitOne(); if (this._handleFrameThreadExecutable) { var thread = new Thread(new ThreadStart(this.FrameHandlerRoutine)); thread.Start(); } this._handleFrameThreadExecutableLock.ReleaseMutex(); }