private void reloadImage() { /// reload the img from scratch /// redraw the image automatically if (curIndex < 0 || curIndex >= imgList.Count) { return; } try { if (img != null) { img.Dispose(); } img = new UMat(imgList[curIndex].Filename, ImreadModes.Color); char[] delimiterChars = { ',' }; foreach (string process in imgList[curIndex].History) { img = ImageProcessor.getResult(ref img, process.Split(delimiterChars)); } redrawImg(); GC.Collect(); GC.WaitForPendingFinalizers(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void onProcessingApplyClicked(object sender, EventArgs e) { try { ImageProcessingEventArgs ei = (ImageProcessingEventArgs)e; img = ImageProcessor.getResult(ref img, ei.Parameters); HistogramUpdate(img.ToImage <Bgr, Byte>()); redrawImg(); imgList[curIndex].History.Push(ei.ToString()); uiUpdate(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } GC.Collect(); GC.WaitForPendingFinalizers(); }