public void GetKernel_ZeroPointTwoNormalized() { float[] matrix = StandardDeviation.GetKernel(0.2f); Assert.AreEqual(0.9999926f, matrix[1]); Assert.AreEqual(3, matrix.Length); ValidateNormalizedMatrixForm(matrix); }
public void GetKernel_ZeroPointFiveNormalized() { float[] matrix = StandardDeviation.GetKernel(0.5f); Assert.AreEqual(0.7865707f, matrix[2]); Assert.AreEqual(5, matrix.Length); ValidateNormalizedMatrixForm(matrix); }
public void GetKernel_TwoNormalized() { float[] matrix = StandardDeviation.GetKernel(2); Assert.AreEqual(0.0648251921f, matrix[3]); Assert.AreEqual(13, matrix.Length); ValidateNormalizedMatrixForm(matrix); }
public void GetKernel_OneNormalized() { float[] matrix = StandardDeviation.GetKernel(1); Assert.AreEqual(0.3990503f, matrix[3]); Assert.AreEqual(7, matrix.Length); ValidateNormalizedMatrixForm(matrix); }
public void Symmetric_5x1SampleBlurringIsCorrect() { float[,] map = new float[, ] { { 0, 0, 1, 0, 0 } }; float[] kernel = StandardDeviation.GetKernel(0.5f); float[,] blurredMap = Convolution.Symmetric(map, kernel); Assert.AreEqual(0.0002075485f, blurredMap[0, 0], floatPrecision); Assert.AreEqual(0.08373106f, blurredMap[0, 1], floatPrecision); Assert.AreEqual(0.6186935f, blurredMap[0, 2], floatPrecision); Assert.AreEqual(0.08373106f, blurredMap[0, 3], floatPrecision); Assert.AreEqual(0.0002075485f, blurredMap[0, 4], floatPrecision); }
public void GetKernel_NegativeOne() { Assert.Throws <ArgumentException>(() => StandardDeviation.GetKernel(-1)); }
public void GetKernel_Zero() { Assert.Throws <ArgumentException>(() => StandardDeviation.GetKernel(0)); }