Пример #1
0
        private void MatchImages(object sender, RoutedEventArgs e)
        {
            if(_camImageFirst.ImageSource == null || _camImageSec.ImageSource == null)
            {
                MessageBox.Show("Images must be set");
                return;
            }
            if(_camImageFirst.ImageSource.PixelWidth != _camImageSec.ImageSource.PixelWidth ||
                _camImageFirst.ImageSource.PixelHeight != _camImageSec.ImageSource.PixelHeight)
            {
                MessageBox.Show("Images must have same size");
                return;
            }
            if(CalibrationData.Data.IsCamLeftCalibrated == false ||
                CalibrationData.Data.IsCamRightCalibrated == false)
            {
                MessageBox.Show("Cameras must be calibrated");
                return;
            }

            ColorImage imgLeft = new ColorImage();
            imgLeft.FromBitmapSource(_camImageFirst.ImageSource);
            ColorImage imgRight = new ColorImage();
            imgRight.FromBitmapSource(_camImageSec.ImageSource);

            _alg.ImageLeft = imgLeft;
            _alg.ImageRight = imgRight;
            _alg.StatusChanged += _alg_StatusChanged;

            _matcherWindow = new AlgorithmWindow(_alg);
            _matcherWindow.Show();
        }
Пример #2
0
        private void ComputeDistortionCorrectionParameters(object sender, RoutedEventArgs e)
        {
            if(_calibLines.Count > 0)
            {
                var img = _imageControl.ImageSource;
                _distortionCorrector.ImageHeight = img.PixelHeight;
                _distortionCorrector.ImageWidth = img.PixelWidth;
                _distortionCorrector.CorrectionLines = _calibLines;

                AlgorithmWindow algWindow = new AlgorithmWindow(_distortionCorrector);
                algWindow.Show();
            }
        }
Пример #3
0
        private void Calibrate(object sender, RoutedEventArgs e)
        {
            if(CalibrationPoints.Count < 6)
            {
                MessageBox.Show("Need at least 6 points");
                return;
            }
            if(_imageControl.ImageSource == null)
            {
                MessageBox.Show("Calibratiion image must be set");
                return;
            }
            for(int p = 0; p < CalibrationPoints.Count; p++)
            {
                CalibrationPoint cp = CalibrationPoints[p];
                if(cp.GridNum >= RealGrids.Count)
                {
                    // TODO ERROR
                    continue;
                }
                // First compute real point for every calib point
                RealGridData grid = RealGrids[cp.GridNum];
                cp.Real = grid.GetRealFromCell(cp.RealRow, cp.RealCol);
            }

            _calibrator.Points = CalibrationPoints;
            _calibrator.Grids = RealGrids;

            AlgorithmWindow algWindow = new AlgorithmWindow(_calibrator);
            algWindow.Show();
        }
Пример #4
0
        private void Calibrate(object sender, RoutedEventArgs e)
        {
            if(CalibrationData.Data.IsCamLeftCalibrated == false ||
                CalibrationData.Data.IsCamRightCalibrated == false)
            {
                MessageBox.Show("Cameras need to be initialy calibrated");
                return;
            }

            _calibrator.CalibPointsLeft = new List<CalibrationPoint>(CalibrationPointsLeft.Count);
            _calibrator.CalibPointsRight = new List<CalibrationPoint>(CalibrationPointsLeft.Count);
            for(int i = 0; i < CalibrationPointsLeft.Count; ++i)
            {
                var cleft = CalibrationPointsLeft[i];
                var cright = CalibrationPointsRight.Find((cp) =>
               {
                   return cp.GridNum == cleft.GridNum &&
                       cp.RealCol == cleft.RealCol &&
                       cp.RealRow == cleft.RealRow;
               });
                if(cright != null)
                {
                    _calibrator.CalibPointsLeft.Add(cleft);
                    _calibrator.CalibPointsRight.Add(cright);
                }
            }

               // _calibrator.CalibPointsLeft = CalibrationPointsLeft;
            //_calibrator.CalibPointsRight = CalibrationPointsRight;
            _calibrator.CalibGrids = GridsLeft;
               // _calibrator.GridsRight = GridsRight;
            _calibrator.MatchedPointsLeft = MatchedPointsLeft;
            _calibrator.MatchedPointsRight = MatchedPointsRight;

            AlgorithmWindow algWindow = new AlgorithmWindow(_calibrator);
            algWindow.Show();
        }
Пример #5
0
        private void MatchFeatures(object sender, RoutedEventArgs e)
        {
            if(ImageLeft == null || ImageRight == null)
            {
                MessageBox.Show("Base images must be set");
                return;
            }

            //if(_featuresLeft == null || _featuresRight == null)
            //{
            //    MessageBox.Show("Features must be detected");
            //    return;
            //}

            _matcher.ImageLeft = ImageLeft;
            _matcher.ImageRight = ImageRight;
            _matcher.FeatureListLeft = _featuresLeft;
            _matcher.FeatureListRight = _featuresRight;

            AlgorithmWindow _matcherWindow = new AlgorithmWindow(_matcher);
            _matcherWindow.Show();
        }
Пример #6
0
        private void FindFeatures(object sender, RoutedEventArgs e)
        {
            _featureDetector.ImageLeft = _imgLeft;
            _featureDetector.ImageRight = _imgRight;

            AlgorithmWindow _matcherWindow = new AlgorithmWindow(_featureDetector);
            _matcherWindow.Show();
        }