Beispiel #1
0
        /* Form on line of calibration data that represents one calibration point in the format
         * expected by Tsai3D calibration program */
        private string GetCalibrationPointString(Camera cam, CalibrationModel model, int pointIndex)
        {
            string res =
                model.GetPoint(pointIndex).X + " " + model.GetPoint(pointIndex).Y + " " + model.GetPoint(pointIndex).Z + " " + cam.points[pointIndex].X + " " + cam.points[pointIndex].Y;

            return(res);
        }
Beispiel #2
0
        /* Assumes square model with 4 points */
        void Calibrate(int numAcquisitionsPerView, int numViews, double maxDisplacementX, double maxDisplacementY, double maxDisplacementZ)
        {
            CalibrationModel model = new CalibrationModel(17.5);
            double           stepX = (maxDisplacementX / numAcquisitionsPerView);
            double           stepY = (maxDisplacementY / numAcquisitionsPerView);
            double           stepZ = (maxDisplacementZ / numViews);

            CalibrationView[] views = new CalibrationView[numViews];
            int viewIdx             = 0;

            for (double z = 0; z < maxDisplacementZ; z += stepZ, viewIdx++)
            {
                for (double y = 0; y < maxDisplacementY; y += stepY)
                {
                    for (double x = 0; x < maxDisplacementX; x += stepX)
                    {
                        modelControlX.Move(x);
                        modelControlY.Move(y);
                        modelControlZ.Move(z);
                        model.Move(x, y, z);

                        for (int i = 0; i < 4; i++)
                        {
                            views[viewIdx].AddPoint(camera[0].points[i], camera[1].points[i], model.GetPoint(i));
                        }
                    }
                }
            }

            Stereo.CalibrateMultipleViews(views);
        }
Beispiel #3
0
        private void Calibrate1()
        {
            int directionX = 1;
            int directionY = 1;

            double stepX = 0.1;
            double stepY = 0.1;
            double stepZ = 0.1;

            double maxX = 2.1;
            double maxY = 2.1;

            for (double z = 0; z < 0.6; z += stepZ)
            {
                for (double y = 0; y < maxY; y += stepY)
                {
                    for (double x = 0; x < maxX; x += stepX)
                    {
                        model.Move(directionX * stepX, 0, 0);
                        file.WriteLine(model.GetPoint(0).X + " " + model.GetPoint(0).Y + " " + model.GetPoint(0).Z + " " + left.points[0].X + " " + left.points[0].Y + " " + right.points[0].X + " " + right.points[0].Y);
                    }

                    file.Flush();

                    directionX *= -1;
                    maxX        = (directionX < 0) ? 1.8 : 2.1;

                    model.Move(0, directionY * stepY, 0);
                }
                directionY *= -1;
                maxY        = (directionX < 0) ? 1.8 : 2.1;

                model.Move(0, 0, stepZ);
            }

            file.Flush();
            file.Close();
        }