Exemplo n.º 1
0
 private void BtnTrain_Click(object sender, EventArgs e)
 {
     if (bitmap != null)
     {
         PictureViewer pictureViewer = new PictureViewer("train", bitmap);
         pictureViewer.SetBitmap(bitmap);
         pictureViewer.Show();
     }
     else
     {
         MessageBox.Show("Buddy, No Image to train. Please add an Image", "No Image");
     }
 }
Exemplo n.º 2
0
        void progressCrowdCount()
        {
            form1.DisableBtn("count");
            int count = 0;

            this.Show();

            Thread bgThread = new Thread(
                new ThreadStart(() =>
            {
                count = crowdCount();

                this.BeginInvoke(
                    new Action(() =>
                {
                    PictureViewer pictureViewer = new PictureViewer("result", bitmap);
                    pictureViewer.SetBitmap(bitmap);
                    pictureViewer.setResult(result);
                    pictureViewer.SetResultCount(count);
                    pictureViewer.Show();
                    this.Dispose();
                }
                               ));

                form1.setResult("Crowd Count: " + count.ToString());
                form1.EnableBtn("count");
            }
                                ));

            try
            {
                bgThread.Start();
            }catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                MessageBox.Show("Oops, Something went wrong, Please try again", "Error");
            }
        }