private void ToMatrix_OnClick(object sender, RoutedEventArgs e)
        {
            var regex        = new Regex("[^1]*[^3]*[^5]*[^7]*[^9]*");
            var rowsMatch    = regex.Match(RowsBox.Text);
            var columnsMatch = regex.Match(ColumnsBox.Text);
            var matrixEditor = new ConvolutionMatrixEditor(int.Parse(RowsBox.Text), int.Parse(ColumnsBox.Text));

            this.DialogResult = matrixEditor.ShowDialog();
            Convolution       = matrixEditor.Convolution;
            this.Close();
        }
Example #2
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            Convolution = new CustomConvolution()
            {
                Factor       = double.Parse(FactorBox.Text),
                Bias         = double.Parse(BiasBox.Text),
                FilterMatrix = new double[columns, rows]
            };
            for (int i = 0; i < columns; i++)
            {
                for (int j = 0; j < rows; j++)
                {
                    Convolution.FilterMatrix[i, j] = string.IsNullOrEmpty(textBoxes[i, j].Text) ? 0 : double.Parse(textBoxes[i, j].Text);
                }
            }

            this.DialogResult = true;
            this.Close();
        }