Ejemplo n.º 1
0
        //menue strip of open file
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialogImageTextDeepLearning.ShowDialog();
            PictureBoxImageTextDeepLearning.BackgroundImage = Image.FromFile(openFileDialogImageTextDeepLearning.FileName);
            //PictureBoxImageTextDeepLearning.Size = new Size(PictureBoxImageTextDeepLearning.BackgroundImage.Width, PictureBoxImageTextDeepLearning.BackgroundImage.Height);

            PictureBoxImageTextDeepLearning.BackgroundImageLayout = ImageLayout.Stretch;

            PictureBoxImageTextDeepLearning.Refresh();
            PictureBoxImageTextDeepLearning.Update();
        }
Ejemplo n.º 2
0
 //click on open buttonb event
 private void buttonOpen_Click(object sender, EventArgs e)
 {
     //determine file of image name
     openFileDialogImageTextDeepLearning.ShowDialog();
     //Assign content of image on main picture box
     PictureBoxImageTextDeepLearning.BackgroundImage = Image.FromFile(openFileDialogImageTextDeepLearning.FileName);
     //PictureBoxImageTextDeepLearning.Size = new Size(PictureBoxImageTextDeepLearning.BackgroundImage.Width, PictureBoxImageTextDeepLearning.BackgroundImage.Height);
     //set scale
     PictureBoxImageTextDeepLearning.BackgroundImageLayout = ImageLayout.Stretch;
     //refresh and update to pain event occured
     PictureBoxImageTextDeepLearning.Refresh();
     PictureBoxImageTextDeepLearning.Update();
 }
Ejemplo n.º 3
0
        //detection form munue strip
        private void txtDetectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            d = new MainForm();
            d.ShowDialog();



            //textBoxImageTextDeepLearning.Refresh();
            //textBoxImageTextDeepLearning.Update();
            //d.Dispose();
            PictureBoxImageTextDeepLearning.Update();
            PictureBoxImageTextDeepLearning.Refresh();
        }
Ejemplo n.º 4
0
        //detect of literalson image to be text
        private void buttonTxtDetect_Click(object sender, EventArgs e)
        {
            Recognized = false;
            textBoxImageTextDeepLearning.Text = "";

            //detection foregin unnkown app constructor
            d = new MainForm();
            d.ShowDialog();



            //textBoxImageTextDeepLearning.Refresh();
            //textBoxImageTextDeepLearning.Update();
            //d.Dispose();
            PictureBoxImageTextDeepLearning.Update();
            PictureBoxImageTextDeepLearning.Refresh();
        }
Ejemplo n.º 5
0
 //splitation and conjunction of one load image deterministic
 private void buttonSplitationConjunction_Click(object sender, EventArgs e)
 {
     //when there is no image
     if (PictureBoxImageTextDeepLearning.BackgroundImage == null)
     {
         //set image to back image
         PictureBoxImageTextDeepLearning.BackgroundImage = PictureBoxImageTextDeepLearning.Image;
         PictureBoxImageTextDeepLearning.Image           = null;
     }
     //wen ready to splitation
     if (buttonSplitationConjunction.Text == "Splitation")
     {
         //create constructor image
         t = new SmallImageing(PictureBoxImageTextDeepLearning.BackgroundImage);
         //Do splitation
         bool Do = t.Splitation(pictureBoxTest);
         //wen successfull
         if (Do)
         {
             //change operation recurve
             buttonSplitationConjunction.Text = "Conjunction";
             MessageBox.Show("Splited!");
         }
     }
     else//when ready to conjunction
     if (buttonSplitationConjunction.Text == "Conjunction")
     {
         //Do conjunction
         bool Do = t.Conjunction(pictureBoxTest, PictureBoxImageTextDeepLearning);
         //when successfull
         if (Do)
         {
             //assgin conjuncted image to back image and refresh and update to pain even occured
             PictureBoxImageTextDeepLearning.BackgroundImage = t.RootConjuction;
             PictureBoxImageTextDeepLearning.Refresh();
             PictureBoxImageTextDeepLearning.Update();
             buttonSplitationConjunction.Text = "Splitation";
             MessageBox.Show("Conjuncted!");
         }
     }
 }
Ejemplo n.º 6
0
        //main picture boc pain event
        private void PictureBoxImageTextDeepLearning_Paint(object sender, PaintEventArgs e)
        {
            bool Re = false;

            //when foregin is ready
            if (d != null)
            {
                //initiate local vars
                Font  font;
                Brush brush;
                Brush brush2;
                Pen   pen;
                bool  flag2;
                //when is ready top detected unconjuncted shapes set draw parameters
                if (!ReferenceEquals(d.frame, null))
                {
                    font = new Font(d.Font.FontFamily, 24f);
                    e.Graphics.DrawString(d.lbFPS.Text, new Font(d.Font.FontFamily, 16f), Brushes.Yellow, new PointF(1f, 1f));
                    brush  = new SolidBrush(Color.FromArgb(0xff, 0, 0, 0));
                    brush2 = new SolidBrush(Color.FromArgb(0xff, 0xff, 0xff, 0xff));
                    pen    = new Pen(Color.FromArgb(150, 0, 0xff, 0));
                    flag2  = false;
                    if (!flag2)
                    {
                        using (List <Contour <Point> > .Enumerator enumerator = d.processor.contours.GetEnumerator())
                        {
                            while (true)
                            {
                                flag2 = enumerator.MoveNext();
                                if (!flag2)
                                {
                                    break;
                                }
                                Contour <Point> current = enumerator.Current;
                                if (current.Total > 1)
                                {
                                    e.Graphics.DrawLines(Pens.Red, current.ToArray());
                                }
                            }
                        }
                    }
                }
                else
                {
                    return;
                }
                lock (d.processor.foundTemplates)
                {
                    using (List <FoundTemplateDesc> .Enumerator enumerator2 = d.processor.foundTemplates.GetEnumerator())
                    {
                        while (true)
                        {
                            flag2 = enumerator2.MoveNext();
                            if (!flag2)
                            {
                                break;
                            }
                            FoundTemplateDesc current = enumerator2.Current;
                            if (current.template.name.EndsWith(".png") || current.template.name.EndsWith(".jpg"))
                            {
                                d.DrawAugmentedReality(current, e.Graphics);
                                continue;
                            }
                            Rectangle sourceBoundingRect = current.sample.contour.SourceBoundingRect;
                            Point     point = new Point((sourceBoundingRect.Left + sourceBoundingRect.Right) / 2, sourceBoundingRect.Top);
                            string    name  = current.template.name;
                            if (d.showAngle)
                            {
                                name = name + $"angle={((180.0 * current.angle) / 3.1415926535897931):000}°scale={current.scale:0.0}";
                            }
                            if (!Recognized)
                            {
                                textBoxImageTextDeepLearning.Text += name;
                                textBoxImageTextDeepLearning.Refresh();
                                textBoxImageTextDeepLearning.Update();
                                Re = true;
                            }
                            e.Graphics.DrawRectangle(pen, sourceBoundingRect);
                            e.Graphics.DrawString(name, font, brush, new PointF((float)((point.X + 1) - (font.Height / 3)), (float)((point.Y + 1) - font.Height)));
                            e.Graphics.DrawString(name, font, brush2, new PointF((float)(point.X - (font.Height / 3)), (float)(point.Y - font.Height)));
                        }
                    }
                }
            }
            if (Re)
            {
                Recognized = true;
            }
            PictureBoxImageTextDeepLearning.Update();
            PictureBoxImageTextDeepLearning.Refresh();
        }