public void StoreImageData(string savePath, byte[,] imageData)
{
int width = imageData.GetLength(1);
int height = imageData.GetLength(0);
byte[] pixels = new byte[width * height];
for (int j = 0; j < height; j++)
{
for (int i = 0; i < width; i++)
{
pixels[(width * j) + i] = imageData[j, i];
}
}
FileStream stream = new FileStream(savePath + ".dat", FileMode.Create);
stream.Write(pixels,0,width*height);
stream.Dispose();
}