Esempio n. 1
0
        public static Bitmap read_image_gray(Bytearray image, string path)
        {
            Bitmap bitmap = LoadBitmapFromFile(path);

            image.Resize(bitmap.Width, bitmap.Height);
            ImgRoutine.NarrayFromBitmap(image, bitmap);
            return(bitmap);
        }
Esempio n. 2
0
        public static Bitmap read_image_binary(Bytearray image, string path)
        {
            Bitmap bitmap = LoadBitmapFromFile(path);

            image.Resize(bitmap.Width, bitmap.Height);
            ImgRoutine.NarrayFromBitmap(image, bitmap);
            double threshold = (NarrayUtil.Min(image) + NarrayUtil.Max(image)) / 2.0;

            for (int i = 0; i < image.Length1d(); i++)
            {
                image.Put1d(i, (byte)((image.At1d(i) < threshold) ? 0 : 255));
            }
            return(bitmap);
        }