@@ -0,0 +1,2254 @@
+/**%0A * Created by dongyi.kim on 2017-06-07.%0A */%0Apublic class ProposedFilter extends MedianFilter %7B%0A%0A    public ProposedFilter(int kernelSize) %7B%0A        super(kernelSize);%0A    %7D%0A%0A%0A%0A    @Override%0A    public int%5B%5D%5B%5D filtering(int%5B%5D%5B%5D m) %7B%0A        int%5B%5D%5B%5D X = getEmptyOutputMatrix(m);%0A        int h = m.length;%0A        int w = m%5B0%5D.length;%0A        int r = mKernelSize / 2;%0A        int medianIndex = mKernelSize * mKernelSize / 2;%0A        int%5B%5D%5B%5D histogramCounter = new int%5Bw%5D%5B256%5D;%0A        int%5B%5D%5B%5D histogramSubCounter = new int%5Bw%5D%5B16%5D;%0A        int%5B%5D windowCounter = new int%5B256%5D;%0A        for(int i = 0; i %3C h; i++)%7B%0A            for(int j = 0 ; j %3C w; j++)%7B%0A                int color = m%5Bi%5D%5Bj%5D;%0A                int rowToRemove = i - mKernelSize;%0A                if(rowToRemove %3E= 0)%7B%0A                    int colorToRemove = m%5BrowToRemove%5D%5Bj%5D;%0A                    histogramCounter%5Bj%5D%5BcolorToRemove%5D --;%0A                    histogramSubCounter%5Bj%5D%5BcolorToRemove/16%5D --;%0A                %7D%0A                histogramCounter%5Bj%5D%5Bcolor%5D ++;%0A                histogramSubCounter%5Bj%5D%5Bcolor/16%5D++;%0A%0A                int columnToRemove = j - mKernelSize;%0A                for(int csub = 0; csub %3C= 255; csub += 16)%7B%0A                    if(histogramSubCounter%5Bj%5D%5Bcsub/16%5D == 0 && (columnToRemove %3C 0 %7C%7C histogramSubCounter%5BcolumnToRemove%5D%5Bcsub/16%5D == 0 ))%0A                        continue;%0A%0A                    for(int ch = csub; ch %3C csub+16; ch++)%7B%0A                        if(columnToRemove %3E= 0)%7B%0A                            windowCounter%5Bch%5D -= histogramCounter%5BcolumnToRemove%5D%5Bch%5D;%0A                        %7D%0A                        windowCounter%5Bch%5D += histogramCounter%5Bj%5D%5Bch%5D;%0A                    %7D%0A                %7D%0A%0A%0A                if(i %3E= mKernelSize - 1 && j %3E= mKernelSize - 1)%7B%0A                    int x = j - mKernelSize + 1;%0A                    int y = i - mKernelSize + 1;%0A                    int before = 0;%0A                    for(int cw = 0; cw %3C256; cw++)%7B%0A                        before += windowCounter%5Bcw%5D;%0A                        if( before %3E= medianIndex )%7B%0A                            X%5By%5D%5Bx%5D = cw;%0A                            break;%0A                        %7D%0A%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A        return X;%0A    %7D%0A%7D%0A

Create ProposedFilter.java