AdvancedOCR.BitmapConverter.ToDoubles C# (CSharp) Method

ToDoubles() public static method

public static ToDoubles ( this bitmap ) : double[]
bitmap this
return double[]
        public static double[] ToDoubles(this Bitmap bitmap)
        {
            int width = bitmap.Width;
            int height= bitmap.Height;
            int length = width * height;
            double[] result = new double[width * height];

            for (int i = 0; i < result.Length; i++)
            {
                result[i] = 1.0 - (bitmap.GetPixel(i % width, i / width).GetBrightness() * 2.0);
            }
            return result;
        }