Beispiel #1
0
        public static void write_image_gray(string path, Floatarray image)
        {
            Bitmap bitmap = ImgRoutine.NarrayToRgbBitmap(image);

            bitmap.Save(path);
            bitmap.Dispose();
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public static void write_image_gray(Stream stream, Bytearray image, System.Drawing.Imaging.ImageFormat fmt)
        {
            Bitmap bitmap = ImgRoutine.NarrayToRgbBitmap(image);

            bitmap.Save(stream, fmt);
        }