//-------------------------------------------------------------------------------- private void DisplayNumberPalate() { try { //statusStrip1.Items[1].Text = ""; //lay anh bang so ImagePlate.Get_Plate(); //liembt //pictureBox10.Image = ImagePlate.CutTopBottom; //pictureBox11.Image = ImagePlate.Cutplate; //liembt //tao anh bang so LicensePlate = new clsLicensePlate(); LicensePlate.PLATE = ImagePlate.PLATE; //picture.Image = ImagePlate.p; //cat ky tu LicensePlate.Split(ImagePlate.Plate_Type); pbox_area.Image = LicensePlate.p; //display picturebox pictureBox1.Image = LicensePlate.IMAGEARR[0]; pictureBox2.Image = LicensePlate.IMAGEARR[1]; pictureBox3.Image = LicensePlate.IMAGEARR[2]; pictureBox4.Image = LicensePlate.IMAGEARR[3]; pictureBox5.Image = LicensePlate.IMAGEARR[4]; pictureBox6.Image = LicensePlate.IMAGEARR[5]; pictureBox7.Image = LicensePlate.IMAGEARR[6]; pictureBox8.Image = LicensePlate.IMAGEARR[7]; pictureBox9.Image = LicensePlate.IMAGEARR[8]; //recognize Network.IMAGEARR = LicensePlate.IMAGEARR; int sum = LicensePlate.getsumcharacter(); Network.recognition(sum,ImagePlate.Plate_Type); lbPlate.Text = Network.LICENSETEXT.Trim(); show_result(); InsertDataBase(); } catch { statusStrip1.Items[1].Text = "Not Recognized"; } }
//--------------------------------------------------------------------- private void timer1_Tick(object sender, EventArgs e) { try { if (cameraWindow1.Camera.LastFrame != null) { cameraWindow1.Camera.Lock(); if (!flag_motion) { backgroundFrame = AForge.Imaging.Image.Clone(cameraWindow1.Camera.LastFrame); flag_motion = true; } currentFrame = AForge.Imaging.Image.Clone(cameraWindow1.Camera.LastFrame); cameraWindow1.Camera.Unlock(); process_motion(); //textBox1.Text = alarm.ToString("0.###") + " " + time.ToString(); } if (alarm > 0.3) { array_motion.Add(AForge.Imaging.Image.Clone(currentFrame)); time++; } else if (time > 10) { Bitmap[] bitmaps = array_motion.ToArray(); int index = bitmaps.Length; //textBox1.Text = index.ToString(); index = (int)(index * 0.54); ImagePlate = new clsImagePlate(new Bitmap(bitmaps[index])); picture.Image = ImagePlate.IMAGE; array_motion.Clear(); alarm = 0; time = 0; flag_motion = false; timer1.Stop(); tbegin = DateTime.Now; //input_image = sub_img.Apply(input_image); ImagePlate.Get_Plate(); //tao anh bang so LicensePlate = new clsLicensePlate(); LicensePlate.PLATE = ImagePlate.PLATE; picture.Image = LicensePlate.PLATE; //cat ky tu LicensePlate.Split(ImagePlate.Plate_Type); //display picturebox pictureBox1.Image = LicensePlate.IMAGEARR[0]; pictureBox2.Image = LicensePlate.IMAGEARR[1]; pictureBox3.Image = LicensePlate.IMAGEARR[2]; pictureBox4.Image = LicensePlate.IMAGEARR[3]; pictureBox5.Image = LicensePlate.IMAGEARR[4]; pictureBox6.Image = LicensePlate.IMAGEARR[5]; pictureBox7.Image = LicensePlate.IMAGEARR[6]; pictureBox8.Image = LicensePlate.IMAGEARR[7]; pictureBox9.Image = LicensePlate.IMAGEARR[8]; int sum = LicensePlate.getsumcharacter(); //recognize Network.IMAGEARR = LicensePlate.IMAGEARR; Network.recognition(sum,ImagePlate.Plate_Type); lbPlate.Text = Network.LICENSETEXT; show_result(); } } catch (Exception ex) { statusStrip1.Items[1].Text = ex.Message; } }