public void ProcessImageTest() { double[,] diag = Matrix.Magic(5); Bitmap input; new MatrixToImage() { Format = PixelFormat.Format24bppRgb }.Convert(diag, out input); var whitePatch = new WhitePatch(); // Apply the filter Bitmap output = whitePatch.Apply(input); double[,] actual; new ImageToMatrix().Convert(output, out actual); string str = actual.ToString(CSharpMatrixFormatProvider.InvariantCulture); double[,] expected = { { 1, 0.968627450980392, 1, 1, 1 }, { 0.972549019607843, 1, 1, 1, 1 }, { 1, 1, 1, 0.984313725490196, 0.976470588235294 }, { 1, 1, 0.988235294117647, 0.980392156862745, 1 }, { 1, 0.992156862745098, 0.964705882352941, 1, 1 } }; Assert.IsTrue(expected.IsEqual(actual, 1e-6)); }
public void ApplyTest1() { Bitmap image = Properties.Resources.lena_color; // Create the White Patch filter var whitePatch = new WhitePatch(); // Apply the filter Bitmap result = whitePatch.Apply(image); // ImageBox.Show(result); Assert.IsNotNull(result); }