Exemplo n.º 1
0
        //string SamplesPath = @"D:\Dropbox\Thesis\Model3DTests\";

        public MainForm()
        {
            InitializeComponent();
            // Set up image boxes
            pictureBoxLeftImg.FunctionalMode  = Emgu.CV.UI.ImageBox.FunctionalModeOption.Minimum;
            pictureBoxLeftImg.SizeMode        = PictureBoxSizeMode.Zoom;
            pictureBoxRightImg.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.Minimum;
            pictureBoxRightImg.SizeMode       = PictureBoxSizeMode.Zoom;
            // Autoload test image at beginning
            pictureBoxLeftImg.Image  = LeftImage = new Image <Gray, byte>(SamplesPath + "demoL.bmp");
            pictureBoxRightImg.Image = RightImage = new Image <Gray, byte>(SamplesPath + "demoR.bmp");

            // Set up cropping image rectangles
            Rectangle Rect = new Rectangle(new Point(0, 0), pictureBoxLeftImg.Size);

            Rect.Inflate(-10, -10);
            cropLeftRect = new UserRect(Rect);
            cropLeftRect.SetPictureBox(this.pictureBoxLeftImg);
            cropLeftRect.allowDeformingDuringMovement = false;
            cropRightRect         = new UserRect(Rect);
            cropRightRect.isFixed = true;
            cropRightRect.allowDeformingDuringMovement = false;
            cropRightRect.SetPictureBox(this.pictureBoxRightImg);
            cropRightRect.allowDeformingDuringMovement = false;

            pictureBoxLeftImg.MouseMove           += new MouseEventHandler(pictureBoxLeftImg_MouseMove);
            pictureBoxLeftImg.MouseMoveOverImage  += new PictureBoxExtended.MouseMoveOverImageHandler(mouseOverLeftImage);
            pictureBoxRightImg.MouseMoveOverImage += new PictureBoxExtended.MouseMoveOverImageHandler(mouseOverRightImage);
            // Set up background worker
            backgroundWorker.DoWork                    += new DoWorkEventHandler(CreateMesh); // This does the job ...
            backgroundWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted);
            backgroundWorker.ProgressChanged           += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged);
            backgroundWorker.WorkerSupportsCancellation = true; // This allows cancellation.
            backgroundWorker.WorkerReportsProgress      = true;

            // For debugging - set up search area, and templates
            templateLeftRect = new UserRect(new Rectangle(0, 0, 0, 0), Color.Green);
            templateLeftRect.SetPictureBox(this.pictureBoxLeftImg);
            templateLeftRect.isFixed = true;
            templateLeftRect.visible = false;

            templateRightRect = new UserRect(new Rectangle(0, 0, 0, 0), Color.Green);
            templateRightRect.SetPictureBox(this.pictureBoxRightImg);
            templateRightRect.isFixed = true;
            templateRightRect.visible = false;

            searchAreaRect = new UserRect(new Rectangle(0, 0, 0, 0), Color.Yellow);
            searchAreaRect.SetPictureBox(this.pictureBoxRightImg);
            searchAreaRect.isFixed = true;
            searchAreaRect.visible = false;

            // Set up parameters in textboxes
            textBoxPatternSz.Text = TemplateSz.ToString();
            textBoxStep.Text      = Step.ToString();
            textBoxRangeX.Text    = SearchAreaX.ToString();
            textBoxRangeY.Text    = SearchAreaY.ToString();

            progressBar.Maximum = 100;  // using percetange
        }
Exemplo n.º 2
0
        //string SamplesPath = @"D:\Dropbox\Thesis\Model3DTests\";
        public MainForm()
        {
            InitializeComponent();
            // Set up image boxes
            pictureBoxLeftImg.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.Minimum;
            pictureBoxLeftImg.SizeMode = PictureBoxSizeMode.Zoom;
            pictureBoxRightImg.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.Minimum;
            pictureBoxRightImg.SizeMode = PictureBoxSizeMode.Zoom;
            // Autoload test image at beginning
            pictureBoxLeftImg.Image = LeftImage = new Image<Gray, byte>(SamplesPath + "demoL.bmp");
            pictureBoxRightImg.Image = RightImage = new Image<Gray, byte>(SamplesPath + "demoR.bmp");

            // Set up cropping image rectangles
            Rectangle Rect = new Rectangle(new Point(0, 0), pictureBoxLeftImg.Size);
            Rect.Inflate(-10,-10);
            cropLeftRect = new UserRect(Rect);
            cropLeftRect.SetPictureBox(this.pictureBoxLeftImg);
            cropLeftRect.allowDeformingDuringMovement = false;
            cropRightRect = new UserRect(Rect);
            cropRightRect.isFixed = true;
            cropRightRect.allowDeformingDuringMovement = false;
            cropRightRect.SetPictureBox(this.pictureBoxRightImg);
            cropRightRect.allowDeformingDuringMovement = false;

            pictureBoxLeftImg.MouseMove += new MouseEventHandler(pictureBoxLeftImg_MouseMove);
            pictureBoxLeftImg.MouseMoveOverImage += new PictureBoxExtended.MouseMoveOverImageHandler(mouseOverLeftImage);
            pictureBoxRightImg.MouseMoveOverImage += new PictureBoxExtended.MouseMoveOverImageHandler(mouseOverRightImage);
            // Set up background worker
            backgroundWorker.DoWork += new DoWorkEventHandler(CreateMesh); // This does the job ...
            backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted);
            backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged);
            backgroundWorker.WorkerSupportsCancellation = true; // This allows cancellation.
            backgroundWorker.WorkerReportsProgress = true;

            // For debugging - set up search area, and templates
            templateLeftRect = new UserRect(new Rectangle(0, 0, 0, 0), Color.Green);
            templateLeftRect.SetPictureBox(this.pictureBoxLeftImg);
            templateLeftRect.isFixed = true;
            templateLeftRect.visible = false;

            templateRightRect = new UserRect(new Rectangle(0, 0, 0, 0), Color.Green);
            templateRightRect.SetPictureBox(this.pictureBoxRightImg);
            templateRightRect.isFixed = true;
            templateRightRect.visible = false;

            searchAreaRect = new UserRect(new Rectangle(0, 0, 0, 0), Color.Yellow);
            searchAreaRect.SetPictureBox(this.pictureBoxRightImg);
            searchAreaRect.isFixed = true;
            searchAreaRect.visible = false;

            // Set up parameters in textboxes
            textBoxPatternSz.Text = TemplateSz.ToString();
            textBoxStep.Text = Step.ToString();
            textBoxRangeX.Text = SearchAreaX.ToString();
            textBoxRangeY.Text = SearchAreaY.ToString();

            progressBar.Maximum = 100;  // using percetange
        }