예제 #1
0
 private void OnMapButtonClicked(object sender, EventArgs e)
 {
     if (m_MapForm == null || m_MapForm.IsDisposed)
     {
         m_MapForm = new MapForm(m_RobotPath);
     }
     m_MapForm.Show(this);
 }
예제 #2
0
        public MainForm()
        {
            InitializeComponent();

            CameraParameters cameraParameters = null;
            HomographyMatrix groundProjectionTransformation = null;

            bool useCamera = false;


            _CamIP = Prompt.ShowDialog("OK para testes", "Conexão Camara");
            if (_CamIP != "")
            {
                useCamera = true;
            }

            if (useCamera)
            {
                //Emgu.CV.CvInvoke.cvCreateFileCapture("http://*****:*****@cam_address/axis-cgi/mjpg/video.cgi?resolution=1280x720&req_fps=30&.mjpg");
                m_Capture = new Capture(0);
                m_Capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 1280);
                m_Capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 720);

                cameraParameters = CameraParameters.Load(@"..\..\CalibrationFiles\MicrosoftCinemaFocus12.txt");

                groundProjectionTransformation = HomographyMatrixSupport.Load(@"..\..\CalibrationFiles\BirdsEyeViewTransformationForCalculation.txt");
            }
            else
            {
                m_Capture        = new Capture(@"..\..\CalibrationFiles\2010-07-18 11-10-22.853.wmv");
                m_Timer.Interval = 33;
                m_Timer.Enabled  = true;

                cameraParameters = CameraParameters.Load(@"..\..\CalibrationFiles\MicrosoftCinemaFocus12.txt");

                groundProjectionTransformation = HomographyMatrixSupport.Load(@"..\..\CalibrationFiles\BirdsEyeViewTransformationForCalculation.txt");
            }

            m_VisualOdometer = new VisualOdometer(m_Capture, cameraParameters, groundProjectionTransformation, new OpticalFlow());

            UpdateFromModel();

            m_VisualOdometer.Changed += new EventHandler(OnVisualOdometerChanged);
            Application.Idle         += OnApplicationIdle;

            if (m_MapForm == null || m_MapForm.IsDisposed)
            {
                m_MapForm = new MapForm(m_RobotPath);
            }

            m_MapForm.Show();
        }