private void button3_Click(object sender, EventArgs e) { Bitmap bm = new Bitmap(original_image); Bitmap32 bm32 = new Bitmap32(bm); bm32.Grayscale(); pictureBox2.Image = bm; grayscale_image = bm; label2.ForeColor = Color.Green; ImageProcessing img_p = new ImageProcessing(); Point loc = img_p.GetLocation_Top_Left(grayscale_image); Point loc1 = img_p.GetLocation_Width_Height(grayscale_image); label3.ForeColor = Color.Green; label5.Text = String.Format("X = {0}; Y = {1}", loc.X, loc.Y); // +10 + 10 label6.Text = String.Format("XW = {0}; YH = {1}", loc1.X, loc1.Y); Bitmap bmp_gr = new Bitmap(grayscale_image); Image <Bgr, Byte> sourceImage1 = new Image <Bgr, Byte>(bmp_gr); sourceImage1.ROI = new Rectangle(loc.X + 10, loc.Y + 10, (loc1.X - loc.X) - 20, (loc1.Y - loc.Y) - 20); pictureBox2.Image = sourceImage1.Clone().ToBitmap(); cliped_image = sourceImage1.Clone().ToBitmap(); pictureBox2.SizeMode = PictureBoxSizeMode.AutoSize; label4.ForeColor = Color.Green; }
private void button6_Click(object sender, EventArgs e) { Bitmap bm = new Bitmap(cv_image); Bitmap32 bm32 = new Bitmap32(bm); bm32.Grayscale(); pictureBox2.Image = bm; ImageProcessing pr = new ImageProcessing(); List <char> res = pr.ProcessResults(pictureBox2.Image); for (int i = 0; i < 10; i++) { textBox2.Text += string.Format("{0}) {1} \n", i + 1, res[i]); } }