public static void SetAdaptTreshold(IplImage gray, ref IplImage threshold, AdaptiveThresholdType aptTValue, ThresholdType thsType, double ThresholdValue, int AdaptativeVal1, int AdaptativeVal2) { try { gray.AdaptiveThreshold(threshold, ThresholdValue, aptTValue, thsType, AdaptativeVal1, AdaptativeVal1); } catch (Exception e) { MainWindow.Instance.OpenDialog("Invalid value combination", e.Message); } }