Beispiel #1
0
        private void plateTestingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // protege de executar a função sem ainda ter aberto a imagem
            {
                return;
            }

            Cursor = Cursors.WaitCursor; // cursor relogio
            //copy Undo Image
            imgUndo  = img.Copy();
            imgPlate = img.Copy();
            //Image<Bgr, Byte> imgChar1 = null;
            //Image<Bgr, Byte> imgChar2 = null;
            //Image<Bgr, Byte> imgChar3 = null;
            //Image<Bgr, Byte> imgChar4 = null;
            //Image<Bgr, Byte> imgChar5 = null;
            //Image<Bgr, Byte> imgChar6 = null;
            Rectangle loc;
            Rectangle lp1;
            Rectangle lp2;
            Rectangle lp3;
            Rectangle lp4;
            Rectangle lp5;
            Rectangle lp6;

            string l1;
            string l2;
            string l3;
            string l4;
            string l5;
            string l6;
            string l7;
            string l8;
            string l9;

            ImageClass.LP_Recognition(img, imgUndo, out loc, out lp1, out lp2, out lp3, out lp4, out lp5, out lp6, out l1, out l2, out l3, out l4, out l5, out l6, out l7, out l8, out l9);


            Console.Write(l1);
            Console.Write(l2);

            //Image<Bgr, Byte> test = imgPlate.Copy();
            //ImageClass.ConvertToBW(test, 100);
            img = imgUndo.Copy();

            img.Draw(loc, new Bgr(Color.Red), 1);
            img.Draw(lp1, new Bgr(Color.Red), 1);
            img.Draw(lp2, new Bgr(Color.Red), 1);
            img.Draw(lp3, new Bgr(Color.Red), 1);
            img.Draw(lp4, new Bgr(Color.Red), 1);
            img.Draw(lp5, new Bgr(Color.Red), 1);
            img.Draw(lp6, new Bgr(Color.Red), 1);

            Console.Write("-" + l3 + l4 + "-" + l5 + l6);
            ImageViewer.SizeMode = PictureBoxSizeMode.Zoom;
            ImageViewer.Dock     = DockStyle.Fill;
            ImageViewer.Image    = img.Bitmap;
            ImageViewer.Refresh(); // atualiza imagem no ecrã
            Cursor = Cursors.Default;
        }