public void SauvolaTest2()
{
double[,] diag = Matrix.Magic(5);
Bitmap input;
new MatrixToImage().Convert(diag, out input);
// Create a new Variance filter
SauvolaThreshold filter = new SauvolaThreshold();
Assert.AreEqual(PixelFormat.Format8bppIndexed, input.PixelFormat);
// Apply the filter
Bitmap output = filter.Apply(input);
double[,] actual;
new ImageToMatrix().Convert(output, out actual);
Assert.AreEqual(PixelFormat.Format8bppIndexed, output.PixelFormat);
string str = actual.ToString(CSharpMatrixFormatProvider.InvariantCulture);
double[,] expected = new double[,]
{
{ 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1 }
};
Assert.IsTrue(expected.IsEqual(actual, 1e-6));
}