private void button2_Click(object sender, EventArgs e) { if (checkBox5.Checked == false) { if (numericUpDown1.Value > numericUpDown2.Value) { if (numericUpDown4.Value > numericUpDown3.Value) { if (pictureBox1.Image != null) { //Fall in (Within range gets removed) // 20, 160 10, 255 Bitmap CalculatedMask = BackProjection.BackProject((Bitmap)pictureBox1.Image, new int[] { (int)numericUpDown2.Value, (int)numericUpDown1.Value }, new int[] { (int)numericUpDown3.Value, (int)numericUpDown4.Value }, checkBox4.Checked); if (checkBox3.Checked) { pictureBox2.Image = CalculatedMask; } else { pictureBox2.Image = BackProjection.SuperPositionedImage(CalculatedMask, (Bitmap)pictureBox1.Image, checkBox6.Checked); } GC.Collect(); } else { MessageBox.Show("No Image loaded!"); } } else { MessageBox.Show("Error! The min Saturation is larger then the max Saturation."); } } else { MessageBox.Show("Error! The min Hue is larger then the max hue."); } } else { //Get Values Hsv Max = new Hsv((double)trackBar1.Value, 360, 75); Hsv Min = new Hsv((double)trackBar2.Value, 0, 75); //MessageBox.Show(Max.Hue.ToString() + ", " + Max.Satuation.ToString() + ", " + Max.Value.ToString(), "Max"); //MessageBox.Show(Min.Hue.ToString() + ", " + Min.Satuation.ToString() + ", " + Min.Value.ToString(), "Min"); Bitmap CalculatedMask = BackProjection.BackProject((Bitmap)pictureBox1.Image, new int[] { (int)Min.Hue, (int)Max.Hue }, new int[] { (int)Min.Satuation, (int)Max.Satuation }, true); if (checkBox3.Checked) { pictureBox2.Image = CalculatedMask; } else { pictureBox2.Image = BackProjection.SuperPositionedImage(CalculatedMask, (Bitmap)pictureBox1.Image, checkBox6.Checked); } } GC.Collect(); }
private void button2_Click(object sender, EventArgs e) { if (numericUpDown1.Value > numericUpDown2.Value) { if (numericUpDown4.Value > numericUpDown3.Value) { if (pictureBox1.Image != null) { //Fall in (Within range gets removed) // 20, 160 10, 255 Bitmap CalculatedMask = BackProjection.BackProject((Bitmap)pictureBox1.Image, new int[] { (int)numericUpDown2.Value, (int)numericUpDown1.Value }, new int[] { (int)numericUpDown3.Value, (int)numericUpDown4.Value }); if (checkBox3.Checked) { pictureBox2.Image = CalculatedMask; } else { pictureBox2.Image = BackProjection.SuperPositionedImage(CalculatedMask, (Bitmap)pictureBox1.Image); } GC.Collect(); } else { MessageBox.Show("No Image loaded!"); } } else { MessageBox.Show("Error! The min Saturation is larger then the max Saturation."); } } else { MessageBox.Show("Error! The min Hue is larger then the max hue."); } }
private void button5_Click(object sender, EventArgs e) //Debugging button (ignore) { pictureBox2.Image = BackProjection.BackProject((Bitmap)pictureBox1.Image, new int[] { (int)numericUpDown2.Value, (int)numericUpDown1.Value }, new int[] { (int)numericUpDown3.Value, (int)numericUpDown4.Value }, checkBox4.Checked); GC.Collect(); }