Exemple #1
0
//------------------------------------------------------------------------------
        private void open_bitmap()
        {
            try
            {
                OpenFileDialog op = new OpenFileDialog();
                op.InitialDirectory = Application.StartupPath + "\\foreground";
                op.Filter = ("Image files (*.jpg,*.png,*.tif,*.bmp,*.gif)|*.jpg;*.png;*.tif;*.bmp;*.gif|JPG files (*.jpg)|*.jpg|PNG files (*.png)|*.png|TIF files (*.tif)|*.tif|BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif|All files(*.*)|*.*");
                if (op.ShowDialog() == DialogResult.OK)
                {
                    if (op.FileName != null)
                    {
                        StreamReader bitmap_file_stream = new StreamReader(op.FileName);
                        string bmp_file_name = Path.GetFileName(op.FileName);
                        ImagePlate = new clsImagePlate(new Bitmap(op.FileName));

                        bitmap_file_stream.Close();
                        picture.Image = ImagePlate.IMAGE;
                        DisplayNumberPalate();
                    }

                }
            }
            catch (Exception ex)
            {
                statusStrip1.Items[1].Text=ex.Message;
            }
        }
Exemple #2
0
//--------------------------------------------------------------------------------- 
        private void btnCapture_Click(object sender, EventArgs e)
        {
            try
            {

                timer1.Stop();
                cameraWindow1.Camera.Lock();
                picture.Image = AForge.Imaging.Image.Clone(cameraWindow1.Camera.LastFrame);
                cameraWindow1.Camera.Unlock();
                backgroundFrame = new Bitmap(Application.StartupPath + "\\anh\\nen.jpg");
                ImagePlate = new clsImagePlate(new Bitmap(picture.Image));
                
            }
            catch (Exception ex)
            {
                statusStrip1.Items[1].Text = ex.Message;
            }

        }
Exemple #3
0
//---------------------------------------------------------------------
        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;
            }
        }