private void PerformOpperation()
        {
            kernel = new KernelOpperations(orignal);

            int[,] mask = new int[3, 3] {
                { (int)nud1.Value, (int)nud2.Value, (int)nud3.Value },
                { (int)nud4.Value, (int)nud5.Value, (int)nud6.Value },
                { (int)nud7.Value, (int)nud8.Value, (int)nud9.Value }
            };

            divisor = 0;

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    divisor += mask[i, j];
                }
            }

            nudDivisor.Value = divisor;

            if (chbIgnore.Checked == true)
            {
                outlierMethod = 1;
            }

            if (chbRehash.Checked == true)
            {
                outlierMethod = 0;
            }

            if (chbUseExisting.Checked == true)
            {
                outlierMethod = 0;
            }

            if (chbProportional.Checked == true)
            {
                type = 1;
            }

            if (chbTriValue.Checked == true)
            {
                type = 2;
            }

            if (chbCutDown.Checked == true)
            {
                type = 3;
            }

            output = kernel.LinearFilter(mask, type, outlierMethod);

            pctbOutput.Image = output;
            panelOutput.Refresh();
            pctbOutput.Refresh();
        }
Esempio n. 2
0
        private void PerformOpperation()
        {
            this.pctbInput.Image = orignal;
            kernel = new KernelOpperations((Bitmap)this.pctbInput.Image);
            //FillFiveByFiveMask();
            FillMatrix();


            if (chbIgnore.Checked == true)
            {
                outlierMethod = 1;
            }

            if (chbRehash.Checked == true)
            {
                outlierMethod = 0;
            }

            if (chbUseExisting.Checked == true)
            {
                outlierMethod = 0;
            }

            if (chbProportional.Checked == true)
            {
                type = 1;
            }

            if (chbTriValue.Checked == true)
            {
                type = 2;
            }

            if (chbCutDown.Checked == true)
            {
                type = 3;
            }

            //int divisor5x5 = 0;

            //int divisor3x3_1 = 0;
            //int divisor3x3_2 = 0;

            //for (int i = 0; i < 5; i++)
            //    for (int j = 0; j < 5; j++)
            //        divisor5x5 += twoOpMask[i, j];

            //for (int i = 0; i < 3; i++)
            //{
            //    for (int j = 0; j < 3; j++)
            //    {
            //        divisor3x3_1 += maskHor[i, j];
            //        divisor3x3_2 += maskVer[i, j];
            //    }
            //}

            if (chbTwoMasks.Checked == true)
            {
                output = kernel.TwoMaskFilter(maskHor, maskVer, type, outlierMethod);

                //Bitmap output1 = kernel.LinearFilter(maskHor, type, outlierMethod);
                //kernel = new KernelOpperations(output1);
                //output = kernel.LinearFilter(maskVer, type, outlierMethod);
            }
            else if (chbOneMask.Checked == true)
            {
                output = kernel.LinearFilter(twoOpMask, type, outlierMethod);
            }



            pctbOutput.Image = output;
            panelOutput.Refresh();
            pctbOutput.Refresh();
        }