public void LoadGifPicture(string filename) { Bitmap bmp = (Bitmap)Bitmap.FromFile(filename); if (reverse_colours) { byte[] img = new byte[bmp.Width * bmp.Height * 3]; BitmapArrayConversions.updatebitmap(bmp, img); BitmapArrayConversions.RGB_BGR(img); BitmapArrayConversions.updatebitmap_unsafe(img, bmp); } LoadGifPicture(bmp); }
public static void CreateFromStereoPair( string left_image, string right_image, string gif_filename, int delay_mS, float offset_x, float offset_y, float scale, float rotation_degrees, bool reverse_colours, ref string left_image_filename, ref string right_image_filename) { int n = 0; left_image_filename = left_image; right_image_filename = right_image; if (scale < 1) { Bitmap bmp0 = (Bitmap)Bitmap.FromFile(left_image); byte[] img0 = new byte[bmp0.Width * bmp0.Height * 3]; BitmapArrayConversions.updatebitmap(bmp0, img0); if (reverse_colours) { BitmapArrayConversions.RGB_BGR(img0); } int[] lookup0 = new int[bmp0.Width * bmp0.Height * 3]; byte[] img0_scaled = new byte[bmp0.Width * bmp0.Height * 3]; CreateScaledImageLookupColour(scale, lookup0, bmp0.Width, bmp0.Height, 0, 0, 0); for (int i = 0; i < img0_scaled.Length; i++) { img0_scaled[i] = img0[lookup0[i]]; } scale = 1; bmp0 = new Bitmap(bmp0.Width, bmp0.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); BitmapArrayConversions.updatebitmap_unsafe(img0_scaled, bmp0); left_image_filename = left_image.Substring(0, right_image.Length - 4) + "2.bmp"; bmp0.Save(left_image_filename, System.Drawing.Imaging.ImageFormat.Bmp); } Bitmap bmp = (Bitmap)Bitmap.FromFile(right_image); byte[] img = new byte[bmp.Width * bmp.Height * 3]; BitmapArrayConversions.updatebitmap(bmp, img); if (reverse_colours) { BitmapArrayConversions.RGB_BGR(img); } byte[] img_offset = new byte[bmp.Width * bmp.Height * 3]; int[] lookup1 = new int[bmp.Width * bmp.Height * 3]; scale = 1.0f / scale; CreateScaledImageLookupColour(scale, lookup1, bmp.Width, bmp.Height, (int)offset_x, (int)offset_y, rotation_degrees); for (int i = 0; i < img_offset.Length; i++) { img_offset[i] = img[lookup1[i]]; } bmp = new Bitmap(bmp.Width, bmp.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); if (reverse_colours) { BitmapArrayConversions.RGB_BGR(img_offset); } BitmapArrayConversions.updatebitmap_unsafe(img_offset, bmp); right_image_filename = right_image.Substring(0, right_image.Length - 4) + "2.bmp"; bmp.Save(right_image_filename, System.Drawing.Imaging.ImageFormat.Bmp); List <string> images = new List <string>(); images.Add(left_image_filename); images.Add(right_image_filename); CreateAnimatedGif(images, delay_mS, gif_filename, reverse_colours); }