public void ShouldAdd14ValuesAndNotBlowUpInt() { var imf = new IntMedianFilter(12); /* Add twelve of same items, should return same value back as average */ imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); Assert.AreEqual(8, imf.Filtered.X); Assert.AreEqual(12, imf.Filtered.Y); }
public void OneValueShouldReturnThatAsAverage() { var imf = new IntMedianFilter(); imf.Add(new Core.Models.Drawing.Point2D <int>(5, 8)); Assert.AreEqual(5, imf.Filtered.X); Assert.AreEqual(8, imf.Filtered.Y); }
public void TwoValueShouldReturnAverageOfTwoValues() { var imf = new IntMedianFilter(); imf.Add(new Core.Models.Drawing.Point2D <int>(4, 8)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); Assert.AreEqual(6, imf.Filtered.X); Assert.AreEqual(10, imf.Filtered.Y); }
public void ShouldThrowOutThreeHightestValues() { var imf = new IntMedianFilter(12, 3); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 99)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(32, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 16)); imf.Add(new Core.Models.Drawing.Point2D <int>(34, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(89, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 42)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); Assert.AreEqual(8, imf.Filtered.X); Assert.AreEqual(12, imf.Filtered.Y); }
public void ShouldThrowOutThreeLowstValues() { var imf = new IntMedianFilter(12, 3); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(3, 7)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(2, 9)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 6)); imf.Add(new Core.Models.Drawing.Point2D <int>(5, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); Assert.AreEqual(8, imf.Filtered.X); Assert.AreEqual(12, imf.Filtered.Y); }
public void FitlerSizeValueShouldReturnAverageOfNMedianValues() { var imf = new IntMedianFilter(12); /* Add twelve of same items, should return same value back as average */ imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); imf.Add(new Core.Models.Drawing.Point2D <int>(8, 12)); Assert.AreEqual(8, imf.Filtered.X); Assert.AreEqual(12, imf.Filtered.Y); }
public void ShouldAverageMiddle6Values() { var imf = new IntMedianFilter(12); /* Add twelve of same items, should return same value back as average */ imf.Add(new Core.Models.Drawing.Point2D <int>(6, 10)); imf.Add(new Core.Models.Drawing.Point2D <int>(3, 8)); imf.Add(new Core.Models.Drawing.Point2D <int>(10, 14)); imf.Add(new Core.Models.Drawing.Point2D <int>(14, 21)); imf.Add(new Core.Models.Drawing.Point2D <int>(10, 14)); imf.Add(new Core.Models.Drawing.Point2D <int>(5, 44)); imf.Add(new Core.Models.Drawing.Point2D <int>(44, 9)); imf.Add(new Core.Models.Drawing.Point2D <int>(10, 10)); imf.Add(new Core.Models.Drawing.Point2D <int>(6, 32)); imf.Add(new Core.Models.Drawing.Point2D <int>(32, 14)); imf.Add(new Core.Models.Drawing.Point2D <int>(2, 10)); imf.Add(new Core.Models.Drawing.Point2D <int>(6, 10)); Assert.AreEqual(8, imf.Filtered.X); Assert.AreEqual(12, imf.Filtered.Y); }
public void NullValueTest() { var imf = new IntMedianFilter(); Assert.IsNull(imf.Filtered); }