public void ConvertTest3()
{
double[] pixels =
{
0, 0, 0, 0,
0, 1, 1, 0,
0, 1, 1, 0,
0, 0, 0, 0,
};
ArrayToImage conv1 = new ArrayToImage(width: 4, height: 4);
Bitmap image;
conv1.Convert(pixels, out image);
image = new ResizeNearestNeighbor(16, 16).Apply(image);
// Obtain a 16x16 bitmap image
// Bitmap image = ...
// Show on screen
// ImageBox.Show(image, PictureBoxSizeMode.Zoom);
// Create the converter to convert the image to an
// array containing only values between 0 and 1
ImageToArray conv = new ImageToArray(min: 0, max: 1);
// Convert the image and store it in the array
double[] array; conv.Convert(image, out array);
// Show the array on screen
// ImageBox.Show(array, 16, 16, PictureBoxSizeMode.Zoom);
Assert.AreEqual(0, array.Min());
Assert.AreEqual(1, array.Max());
Assert.AreEqual(16 * 16, array.Length);
}