public void DoAfterFrameAction() { if (CaptureSource != null) { CaptureSourceBS = CaptureSource.ToBitmapSource(); CaptureSourceBS.Freeze(); } if (FilteredMat != null) { FilteredMatBS = FilteredMat.ToBitmapSource(); FilteredMatBS.Freeze(); } if (ActionBase != null) { ActionBaseBS = ActionBase.ToBitmapSource(); ActionBaseBS.Freeze(); } if (this.UseCastableDetection()) { CasteableDetectionBS = CasteableDetection.ToBitmapSource(); CasteableDetectionBS.Freeze(); } }