Exemplo n.º 1
0
        private static byte[] ROBERT_Y(BitmapData data, int x, int y, BorderMethod borderMethod, MyFilter filter)
        {//SOBEL Y , not use filter
            byte[]       output = new byte[3];
            MyFilterData kernel = new MyFilterData();

            kernel.fill(data, x, y, borderMethod, MyFilter.GradientKernel(MyFilter.GradientOperator.ROBERT, MyFilter.GradientDirect.Y));
            return(kernel.count(1.0));
        }
Exemplo n.º 2
0
        private static byte[] ROBERT_BOTH(BitmapData data, int x, int y, BorderMethod borderMethod, MyFilter filter)
        {//SOBEL BOTH , not use filter
            byte[]       output  = new byte[3];
            MyFilterData kernel1 = new MyFilterData();
            MyFilterData kernel2 = new MyFilterData();

            kernel1.fill(data, x, y, borderMethod, MyFilter.GradientKernel(MyFilter.GradientOperator.ROBERT, MyFilter.GradientDirect.X));
            kernel2.fill(data, x, y, borderMethod, MyFilter.GradientKernel(MyFilter.GradientOperator.ROBERT, MyFilter.GradientDirect.Y));
            return(MyFilterData.add(kernel1, kernel2).countAbs(1.0));
        }
Exemplo n.º 3
0
        private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {           //operate
            case 0:     //SOBEL
                switch (comboBox2.SelectedIndex)
                {       //direct
                case 0: //BOTH
                    countFilter = new MyFilter(3);
                    setMaskView();
                    break;

                case 1:        //X
                    countFilter = MyFilter.GradientKernel(MyFilter.GradientOperator.SOBEL, MyFilter.GradientDirect.X);
                    setMaskView();
                    break;

                case 2:        //Y
                    countFilter = MyFilter.GradientKernel(MyFilter.GradientOperator.SOBEL, MyFilter.GradientDirect.Y);
                    setMaskView();
                    break;
                }
                break;

            case 1:     //PREWITT
                switch (comboBox2.SelectedIndex)
                {       //direct
                case 0: //BOTH
                    countFilter = new MyFilter(3);
                    setMaskView();
                    break;

                case 1:        //X
                    countFilter = MyFilter.GradientKernel(MyFilter.GradientOperator.PREWITT, MyFilter.GradientDirect.X);
                    setMaskView();
                    break;

                case 2:        //Y
                    countFilter = MyFilter.GradientKernel(MyFilter.GradientOperator.PREWITT, MyFilter.GradientDirect.Y);
                    setMaskView();
                    break;
                }
                break;

            case 2:     //ROBERT
                switch (comboBox2.SelectedIndex)
                {       //direct
                case 0: //BOTH
                    countFilter = new MyFilter(2);
                    setMaskView();
                    break;

                case 1:        //X
                    countFilter = MyFilter.GradientKernel(MyFilter.GradientOperator.ROBERT, MyFilter.GradientDirect.X);
                    setMaskView();
                    break;

                case 2:        //Y
                    countFilter = MyFilter.GradientKernel(MyFilter.GradientOperator.ROBERT, MyFilter.GradientDirect.Y);
                    setMaskView();
                    break;
                }
                break;
            }
        }