private void timAnimation_Tick(object sender, EventArgs e) { if ((File.Exists(processed_left_image_filename)) && (File.Exists(processed_right_image_filename))) { if (picAnimation.Image != null) { picAnimation.Image.Dispose(); } if (animation_state) { Bitmap bmp = (Bitmap)Bitmap.FromFile(processed_left_image_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); } picAnimation.Image = bmp; } else { Bitmap bmp = (Bitmap)Bitmap.FromFile(processed_right_image_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); } picAnimation.Image = bmp; } picAnimation.Refresh(); if (chkAnimate.Checked) { animation_state = !animation_state; } } }
public frmManualOffsetCalibration( string left_image_filename, string right_image_filename, float offset_x, float offset_y, float scale, float rotation_degrees, bool parameters_exist, bool reverse_colours) { InitializeComponent(); this.left_image_filename = left_image_filename; this.right_image_filename = right_image_filename; this.offset_x = offset_x; this.offset_y = offset_y; this.scale = scale; this.rotation_degrees = rotation_degrees; this.reverse_colours = reverse_colours; if (!parameters_exist) { LoadPreviousParameters(); if (left_image_filename != "") { this.left_image_filename = left_image_filename; } if (right_image_filename != "") { this.right_image_filename = right_image_filename; } } if ((this.left_image_filename != null) && (this.left_image_filename != "")) { Console.WriteLine(this.left_image_filename); Bitmap bmp = (Bitmap)Bitmap.FromFile(this.left_image_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); } picLeftImage.Image = bmp; } if ((this.right_image_filename != null) && (this.right_image_filename != "")) { Bitmap bmp = (Bitmap)Bitmap.FromFile(this.right_image_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); } picRightImage.Image = bmp; } txtOffsetX.Text = this.offset_x.ToString(); txtOffsetY.Text = this.offset_y.ToString(); txtScale.Text = this.scale.ToString(); txtRotation.Text = this.rotation_degrees.ToString(); Update(); }