Example #1
0
        public void util_MedianFilter()
        {
            MedianFilterInt32 filter = new MedianFilterInt32(5, 15);

            AssertEx.Equal(filter.Median, 15);

            filter.Input(20);             // [15 20]
            AssertEx.Equal(filter.Median, 17);

            filter.Input(30);             // [15 20 30]
            AssertEx.Equal(filter.Median, 20);

            filter.Input(3);             // [3 15 20 30]
            AssertEx.Equal(filter.Median, 17);

            filter.Input(7);             // [3 7 15 20 30]
            AssertEx.Equal(filter.Median, 15);

            filter.Input(18);             // [3 7 18 20 30]
            AssertEx.Equal(filter.Median, 18);

            filter.Input(0);             // [0 3 7 18 30]
            AssertEx.Equal(filter.Median, 7);
        }
Example #2
0
		public void util_MedianFilter()
		{
			MedianFilterInt32 filter = new MedianFilterInt32(5, 15);

			AssertEx.Equal(filter.Median, 15);

			filter.Input(20); // [15 20]
			AssertEx.Equal(filter.Median, 17);

			filter.Input(30); // [15 20 30]
			AssertEx.Equal(filter.Median, 20);

			filter.Input(3); // [3 15 20 30]
			AssertEx.Equal(filter.Median, 17);

			filter.Input(7); // [3 7 15 20 30]
			AssertEx.Equal(filter.Median, 15);

			filter.Input(18); // [3 7 18 20 30]
			AssertEx.Equal(filter.Median, 18);

			filter.Input(0); // [0 3 7 18 30]
			AssertEx.Equal(filter.Median, 7);
		}