Exemple #1
0
 public void GetKernel_ZeroPointTwoNormalized()
 {
     float[] matrix = StandardDeviation.GetKernel(0.2f);
     Assert.AreEqual(0.9999926f, matrix[1]);
     Assert.AreEqual(3, matrix.Length);
     ValidateNormalizedMatrixForm(matrix);
 }
Exemple #2
0
 public void GetKernel_ZeroPointFiveNormalized()
 {
     float[] matrix = StandardDeviation.GetKernel(0.5f);
     Assert.AreEqual(0.7865707f, matrix[2]);
     Assert.AreEqual(5, matrix.Length);
     ValidateNormalizedMatrixForm(matrix);
 }
Exemple #3
0
 public void GetKernel_TwoNormalized()
 {
     float[] matrix = StandardDeviation.GetKernel(2);
     Assert.AreEqual(0.0648251921f, matrix[3]);
     Assert.AreEqual(13, matrix.Length);
     ValidateNormalizedMatrixForm(matrix);
 }
Exemple #4
0
 public void GetKernel_OneNormalized()
 {
     float[] matrix = StandardDeviation.GetKernel(1);
     Assert.AreEqual(0.3990503f, matrix[3]);
     Assert.AreEqual(7, matrix.Length);
     ValidateNormalizedMatrixForm(matrix);
 }
Exemple #5
0
 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);
 }
Exemple #6
0
 public void GetKernel_NegativeOne()
 {
     Assert.Throws <ArgumentException>(() => StandardDeviation.GetKernel(-1));
 }
Exemple #7
0
 public void GetKernel_Zero()
 {
     Assert.Throws <ArgumentException>(() => StandardDeviation.GetKernel(0));
 }