예제 #1
0
        private void middleColorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Bitmap bmp;

            if (zoomPicBox1.Image != null)
            {
                bmp = ImageProcessing.MiddleColor(zoomPicBox1.Image);
                FormVisualizer form2 = new FormVisualizer(FormVisualizer.DisplayMode.Form1, "");
                form2.SetPicture(bmp);
                form2.Show();
            }
        }
예제 #2
0
        private void sobelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Bitmap bmp = new Bitmap(zoomPicBox1.Image.Width, zoomPicBox1.Image.Height);

            if (zoomPicBox1.Image != null)
            {
                ImageProcessing.SobelPointers(ImageProcessing.Grayscale(zoomPicBox1.Image), bmp, zoomPicBox1.Image.Width, zoomPicBox1.Image.Height);
                FormVisualizer viewResult = new FormVisualizer(FormVisualizer.DisplayMode.Form1, "");
                viewResult.SetPicture(bmp);
                viewResult.Show();
            }
        }
예제 #3
0
        private void cornerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Bitmap bmp;

            if (zoomPicBox1.Image != null)
            {
                long milliseconds1 = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
                bmp = ImageProcessing.FilterImage(zoomPicBox1.Image, Filters.Matrix3x3.Corner);
                long milliseconds2 = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
                MessageBox.Show((milliseconds2 - milliseconds1).ToString());
                FormVisualizer viewResult = new FormVisualizer(FormVisualizer.DisplayMode.Form1, "");
                viewResult.SetPicture(bmp);
                viewResult.Show();
            }
        }
예제 #4
0
        private void buttonCapture_Click(object sender, EventArgs e)
        {
            if (_captureInProgress)
            {  //stop the capture
                buttonCapture.Text = "Start Capture";
                _capture.Pause();
                _capture.ImageGrabbed -= ProcessFrame;
            }
            else
            {
                //start the capture
                buttonCapture.Text = "Stop";
                try
                {
                    int choice;
                    if (radioButton1.Checked)
                    {
                        choice = 0;
                    }
                    else
                    {
                        choice = 1;
                    }
                    _capture = new Capture(choice);
                    _capture.ImageGrabbed += ProcessFrame;
                }
                catch (NullReferenceException excpt)
                {
                    MessageBox.Show(excpt.Message);
                }
                Initialize();
                _capture.Start();
            }

            _captureInProgress = !_captureInProgress;

            vizRed.Show();
            vizGreen.Show();
            vizBlue.Show();
            vizFilters.Show();
            vizOriginal.Show();
            vizYellow.Show();
        }
예제 #5
0
        // Test method for single frame from file
        private void LoadFrame()
        {
            string            strFileName = ImageProcessing.OpenImageFile();
            FormVisualizer    visualizer  = new FormVisualizer(FormVisualizer.DisplayMode.Emgu, "Red");
            Image <Bgr, byte> image       = new Image <Bgr, byte>((Bitmap)Bitmap.FromFile(strFileName));

            strFileName = ImageProcessing.OpenImageFile();
            Image <Bgr, byte> imageOriginal = new Image <Bgr, byte>((Bitmap)Bitmap.FromFile(strFileName));

            List <WeightCenter> weights = FindSpots(image.Data, imageOriginal.Data, image.Rows, image.Cols, FilterColors.Red);

            //List<Point3D> detectedSpots = DetectFace(image.Data, weights, image.Rows, image.Cols, FilterColors.Red);
            //IdentifySide(imageOriginal.Data, detectedSpots[0], detectedSpots[1].ToArray(), detectedSpots[2].ToArray());

            //DrawPoints(imageOriginal.Data, detectedSpots, image.Rows, image.Cols);



            visualizer.Show();
            visualizer.SetPicture(imageOriginal);
        }