@@ -0,0 +1,2396 @@
+import java.util.Random;%0A%0A/**%0A * Created by dongyi.kim on 2017-06-07.%0A */%0Apublic class FilterTest %7B%0A%0A    public static int%5B%5D%5B%5D getRandomImage(int height, int width)%7B%0A        int%5B%5D%5B%5D m = new int%5Bheight%5D%5Bwidth%5D;%0A        Random random = new Random();%0A        for(int i = 0 ; i %3C 10000 ; i++)%7B%0A            int left = random.nextInt(width);%0A            int bottom = random.nextInt(height);%0A            int top = bottom + random.nextInt( Math.min(height - bottom, 100));%0A            int right = left + random.nextInt( Math.min(100,width - left));%0A            for(int x = left; x%3C=right; x++)%7B%0A                int color = Math.abs(random.nextInt())%25256;%0A                for(int y = bottom; y %3C= top; y++)%7B%0A                    m%5By%5D%5Bx%5D = color;%0A                %7D%0A            %7D%0A        %7D%0A%0A        for(int i = 0 ; i %3C height * width ; i++)%7B%0A            int x = random.nextInt(width-1);%0A            int y = random.nextInt(height-1);%0A            m%5By%5D%5Bx%5D += + random.nextInt()%252;%0A            m%5By%5D%5Bx%5D = Math.max(0, m%5By%5D%5Bx%5D);%0A            m%5By%5D%5Bx%5D = Math.min(255, m%5By%5D%5Bx%5D);%0A%0A        %7D%0A        return m;%0A    %7D%0A%0A    public static void main(String%5B%5D args)%7B%0A%0A%0A        int tn = 10;%0A        for(int r = 0; r %3C= 120; r+=10)%7B%0A            int kernelSize = r * 2 + 1;%0A            MedianFilter%5B%5D filters = new MedianFilter%5B%5D%7B new HuangsFilter(kernelSize), new ProposedFilter(kernelSize)%7D;%0A            double%5B%5D cost = new double%5Bfilters.length%5D;%0A%0A            for(int t = 0 ; t %3C tn; t++)%7B%0A                int%5B%5D%5B%5D m = getRandomImage(1024,1024);%0A                long%5B%5D beginTimes = new long%5Bfilters.length%5D;%0A                long%5B%5D endTimes = new long%5Bfilters.length%5D;%0A%0A                for(int i = 0 ; i %3C filters.length; i++) %7B%0A                    System.gc();%0A                    beginTimes%5Bi%5D = System.currentTimeMillis();%0A                    filters%5Bi%5D.filtering(m);%0A                    endTimes%5Bi%5D = System.currentTimeMillis();%0A                %7D%0A%0A                for(int i = 0 ; i %3C filters.length; i++)%7B%0A                    double tc = (endTimes%5Bi%5D - beginTimes%5Bi%5D) / 1000.f;%0A                    cost%5Bi%5D += tc;%0A                %7D%0A            %7D%0A%0A            for(int i = 0 ; i %3C filters.length; i++)%7B%0A                cost%5Bi%5D /= (double)tn;%0A                System.out.printf(%22%25.5f %22, cost%5Bi%5D);%0A            %7D%0A            System.out.println();%0A%0A%0A        %7D%0A%0A//        for(int i = 0 ; i %3C cost.length; i++)%7B%0A%0A//        %7D%0A%0A    %7D%0A%0A%7D%0A

Create FilterTest.java