예제 #1
0
        /// <summary>
        /// val-->
        /// </summary>
        public static MyFilter HighPassKernel(int option)
        {
            MyFilter highPass = new MyFilter(3);

            switch (option)
            {
            case 2:
                highPass.setData(1);
                highPass[1, 0] = -2;
                highPass[0, 1] = -2;
                highPass[1, 1] = 5;
                highPass[2, 1] = -2;
                highPass[1, 2] = -2;
                return(highPass);

            case 1:
                highPass.setData(-1);
                highPass[1, 1] = 9;
                return(highPass);

            case 0:
            default:
                highPass[1, 0] = -1;
                highPass[0, 1] = -1;
                highPass[1, 1] = 5;
                highPass[2, 1] = -1;
                highPass[1, 2] = -1;
                return(highPass);
            }
        }
예제 #2
0
 protected new void initialForm()
 {
     openEnable = openEnable;
     outlierToolStripMenuItem.Enabled = false;
     mode           = mode;
     textBox2.Lines = info;
     countFilter.setData(1.0);
     countFilter[1, 1] = 0;
 }
예제 #3
0
        protected virtual void button1_Click(object sender, EventArgs e)
        {
            MyFilter.FilterCount countMethod = null;
            double SNR      = 0.0;
            double costTime = 0;

            if (radioButton1.Checked)
            {
                countMethod = MyFilter.meanBlur;
            }
            else if (radioButton2.Checked)
            {
                countMethod = MyFilter.medianBlur;
            }
            else if (radioButton3.Checked)
            {
                countMethod = MyFilter.pseudoMedianBlur;
            }
            DateTime curTime = DateTime.Now;
            MyFilter filter  = new MyFilter(trackBar1.Value);

            if (radioButton4.Checked)//rect
            {
                filter.setData(1.0);
            }
            else if (radioButton5.Checked)
            {//cross
                filter.setData(Double.NegativeInfinity);
                if (trackBar1.Value % 2 == 0)
                {//even
                    int st, ed;
                    ed = trackBar1.Value / 2;
                    st = ed - 1;
                    filter.setData(st, 0, ed, trackBar1.Value - 1, 1.0);
                    filter.setData(0, st, trackBar1.Value - 1, ed, 1.0);
                }
                else
                {//odd
                    int t = trackBar1.Value / 2;
                    filter.setData(t, 0, t, trackBar1.Value - 1, 1.0);
                    filter.setData(0, t, trackBar1.Value - 1, t, 1.0);
                }
            }
            countOutView   = MyDeal.filter2D(imgView, MyFilter.BorderMethod.NULL, countMethod, filter, progress);
            outView        = countOutView;
            costTime       = DateTime.Now.Subtract(curTime).TotalMilliseconds;
            SNR            = MyDeal.SNR(imgView, outView);
            textBox2.Lines = countInfo(countMethod, trackBar1.Value, SNR, costTime);
        }