LitDev.Engines.FIP.Matrix2ImageLog C# (CSharp) Method

Matrix2ImageLog() public method

Converts array elements into pixel values (values normalized using 10-base logarithm)
public Matrix2ImageLog ( Double Matrix ) : Bitmap
Matrix Double Array
return System.Drawing.Bitmap
        public Bitmap Matrix2ImageLog(Double[,] Matrix)
        {
            Bitmap img = new Bitmap(Matrix.GetLength(0), Matrix.GetLength(1));

            Double max = Matrix.Cast<Double>().Max();

            for (int i = 0; i < Matrix.GetLength(0); i++)
            {
                for (int j = 0; j < Matrix.GetLength(1); j++)
                {

                    Double a = 255 / Math.Log10(1 + max);

                    int value = (int)(a * Math.Log10(1 + Matrix[i, j]));

                    Color p = Color.FromArgb(255, value, value, value);

                    img.SetPixel(i, j, p);
                }
            }

            return img;
        }