Beispiel #1
0
        private void learnCalibrationButton_Click(object sender, EventArgs e)
        {
            string learnCalibrationText = learnCalibrationButton.Text;

            learnCalibrationButton.Text = "Learning...";
            Update();

            // Set up the calibration grid options.
            // Dots in the grid image are horizontally and vertically 6.35 mm apart.
            // The dots have a pixel intensity in the range [0, 128].
            CalibrationGridOptions calibrationGridOptions = new CalibrationGridOptions(new GridDescriptor(.635, .635, CalibrationUnit.Centimeter), new Range(0, 128));

            // Set up the calibration options.
            LearnCalibrationOptions learnCalibrationOptions = new LearnCalibrationOptions(new CoordinateSystem(), CalibrationMethod.Nonlinear, ScalingMethod.ScaleToPreserveArea, CalibrationCorrectionMode.FullImage);

            learnCalibrationOptions.LearnCorrectionTable = true;
            learnCalibrationOptions.LearnErrorMap        = true;

            // Learn the Grid Image calibration.
            Algorithms.LearnCalibrationGrid(calibrationTemplate, calibrationGridOptions, learnCalibrationOptions);

            // Restore the original description.
            learnCalibrationButton.Text = learnCalibrationText;

            // Update the command buttons.
            learnCalibrationButton.Enabled = false;
            loadTargetButton.Enabled       = true;
        }
Beispiel #2
0
        private void learnCalibrationButton_Click(object sender, EventArgs e)
        {
            // Set up the grid options.
            CalibrationGridOptions gridOptions = new CalibrationGridOptions(new GridDescriptor(.5, .5), new Range(0, 128));

            // Setup the learn calibration options.
            LearnCalibrationOptions learnOptions = new LearnCalibrationOptions(new CoordinateSystem(), CalibrationMethod.Perspective, ScalingMethod.ScaleToFit, CalibrationCorrectionMode.FullImage);

            learnOptions.LearnCorrectionTable = false;
            learnOptions.LearnErrorMap        = false;

            // Learn the calibration from the grid image.
            Algorithms.LearnCalibrationGrid(imageViewer1.Image, gridOptions, learnOptions);

            // Update command buttons.
            learnCalibrationButton.Enabled = false;
            measureDistancesButton.Enabled = true;
        }