예제 #1
0
            public byte[] countAbs(double rate)
            {// sigma each pixel in _data (rate*pixel) && abs output
                byte[]   output = new byte[3];
                double[] temp   = new double[3];
                foreach (double[] pixel in _data)
                {
                    if (pixel != null)
                    {
                        temp[0] += pixel[0];
                        temp[1] += pixel[1];
                        temp[2] += pixel[2];
                    }
                }

                temp[0] = Math.Abs(temp[0] * rate);
                temp[1] = Math.Abs(temp[1] * rate);
                temp[2] = Math.Abs(temp[2] * rate);
                output  = MyFilterData.boundPixel(temp);
                return(output);
            }
예제 #2
0
        public static byte[] pseudoMedianBlur(BitmapData data, int x, int y, BorderMethod borderMethod, MyFilter filter)
        {//this is a FilterCount, Mean Blur
            byte[] output = new byte[3];
            int    size   = filter.size;

            if (size <= 1)
            {
                return(getPixel(data, x, y, borderMethod));
            }
            else
            {
                MyFilterData kernel = new MyFilterData();
                int          pixels = 0;
                pixels = kernel.fill(data, x, y, borderMethod, filter);
                List <double>[] sortList = kernel.sort();
                double[]        pixel    = new double[3];
                pixel[0] = sortList[0].ElementAt <double>(sortList[0].Count / 2);
                pixel[1] = sortList[1].ElementAt <double>(sortList[1].Count / 2);
                pixel[2] = sortList[2].ElementAt <double>(sortList[2].Count / 2);
                return(MyFilterData.boundPixel(pixel));
            }
        }