devilmushroom Ответов: 1

Ошибка перегрузки C# - калибровка камеры


я сделал калибровку камеры с помощью c#, и эта ошибка-то, что я получаю. кто-нибудь может мне помочь, что мне делать? вот мой код

#region Methods
        public void Solve()
        {
            MCvPoint3D32f[][] platePointsperView = new MCvPoint3D32f[_imageNumber][];
            PointF[][] crossesperView = new PointF[_imageNumber][];
            int index = 0;
            Trace.WriteLine("Camera Calibration");
            foreach (Crosses crosses in _crosses.CrossesOnImage)
            {

                ComposeInputPerView(crosses, ref crossesperView[index], ref platePointsperView[index]);
                //crossesperView[index] = ComposeInputCrossesCoordPerView(crosses);
                index++;
            }

            //calculate calibration
            CameraCalibration.CalibrateCamera(platePointsperView, crossesperView,
                                                _imageSize,
                                                _ioParams,
                                                Emgu.CV.CvEnum.CALIB_TYPE.DEFAULT,
                                                out _eoParams);
            DisplayIOParams(_ioParams);
            double fovx =0.0;
            double fovy=0.0;
            double focal=0.0;
            MCvPoint2D64f pp = new MCvPoint2D64f();
            double aspect = 0.0;
            CvInvoke.cvCalibrationMatrixValues(_ioParams.IntrinsicMatrix, _imageSize.Width, _imageSize.Height,
                4.9, 3.7, ref fovx, ref fovy, ref focal, ref pp, ref aspect);
            //CvInvoke.cvCalibrationMatrixValues(_ioParams.IntrinsicMatrix, _imageSize.Width, _imageSize.Height,
            //     0.0, 0.0, ref fovx, ref fovy, ref focal, ref pp, ref aspect);
            Trace.WriteLine("fovx = " + fovx.ToString());
            Trace.WriteLine("fovy = " + fovy.ToString());
            Trace.WriteLine("focal = " + focal.ToString());
            Trace.WriteLine("aspect ratio = " + aspect.ToString());
            Trace.WriteLine("principal point x,y: " + pp.x.ToString() + " , " + pp.y.ToString());
            PrintCalibrationParameters();

            //CameraCalibration.CalibrateCamera(platePointsperView, crossesperView,
            //                        _imageSize,
            //                        _ioParams,
            //                        Emgu.CV.CvEnum.CALIB_TYPE.CV_CALIB_FIX_FOCAL_LENGTH,
            //                        out _eoParams);

            //Trace.WriteLine("fovx = " + fovx.ToString());
            //Trace.WriteLine("fovy = " + fovy.ToString());
            //Trace.WriteLine("focal = " + focal.ToString());
            //Trace.WriteLine("aspect ratio = " + aspect.ToString());
            //Trace.WriteLine("principal point x,y: " + pp.x.ToString() + " , " + pp.y.ToString());
            //PrintCalibrationParameters();

            //CameraCalibration.CalibrateCamera(platePointsperView, crossesperView,
            //            _imageSize,
            //            _ioParams,
            //            Emgu.CV.CvEnum.CALIB_TYPE.CV_CALIB_FIX_PRINCIPAL_POINT | Emgu.CV.CvEnum.CALIB_TYPE.CV_CALIB_FIX_K1,
            //            out _eoParams);

            //Trace.WriteLine("fovx = " + fovx.ToString());
            //Trace.WriteLine("fovy = " + fovy.ToString());
            //Trace.WriteLine("focal = " + focal.ToString());
            //Trace.WriteLine("aspect ratio = " + aspect.ToString());
            //Trace.WriteLine("principal point x,y: " + pp.x.ToString() + " , " + pp.y.ToString());
            //PrintCalibrationParameters();
        }

        private void ComposeInputPerView(Crosses crosses, ref PointF[] imgPoints, ref MCvPoint3D32f[] platePoints)
        {
            //MCvPoint3D32f[] temp = null;
            //create the query for image points
            IEnumerable<Cross> sortedCrossPoints = from crossPt in crosses.CrossPoints
                                    orderby (int.Parse(crossPt.LabelName))
                                    select crossPt;
            List<PointF> tempCross = new List<PointF>();

            foreach (Cross c in sortedCrossPoints)
            {
                //create PointF
                PointF pt = new PointF(c.Point2D.X, c.Point2D.Y);
                tempCross.Add(pt);
                //Trace.WriteLine(c.LabelName + c.Point2D.ToString()+ "  " + pt.X.ToString() + " ; " + pt.Y.ToString());
            }
            //Trace.WriteLine("Number of list: " + tempCross.Count.ToString());
            imgPoints = tempCross.ToArray();

            //Create the query for plate points
            List<MCvPoint3D32f> ptsCv = new List<MCvPoint3D32f>();
            foreach (Cross c in sortedCrossPoints)
            {
                String label = c.LabelName;
                foreach (PlateCalibrationPoint pt in _plateCoord.PlatePoints)
                {
                    if (int.Parse(label) == int.Parse(pt.Label))
                    {
                        MCvPoint3D32f p = new MCvPoint3D32f(pt.Point2D.X, pt.Point2D.Y, 0.0f);
                        ptsCv.Add(p);
                    }
                }
            }
            platePoints = ptsCv.ToArray();
        }

        private void DisplayIOParams(IntrinsicCameraParameters io)
        {
            Trace.WriteLine("Intrinsic Camera Parameters:");
            Trace.WriteLine(io.IntrinsicMatrix.Data.ToString());
        }

        private PointF[] ComposeInputCrossesCoordPerView(Crosses crosses)
        {
            PointF[] temp = new PointF[2];
            return temp;
        }

        private void PrintIntrinsicMatrix()
        {
            Trace.WriteLine("Intrinsic Matrix:");
            String line1 = String.Format("{0} {1} {2}", _ioParams.IntrinsicMatrix[0, 0], _ioParams.IntrinsicMatrix[0, 1],
                                        _ioParams.IntrinsicMatrix[0, 2]);
            String line2 = String.Format("{0} {1} {2}", _ioParams.IntrinsicMatrix[1, 0], _ioParams.IntrinsicMatrix[1, 1],
                               _ioParams.IntrinsicMatrix[1, 2]);
            String line3 = String.Format("{0} {1} {2}", _ioParams.IntrinsicMatrix[2, 0], _ioParams.IntrinsicMatrix[2, 1],
                                        _ioParams.IntrinsicMatrix[2, 2]);
            Trace.WriteLine(line1);
            Trace.WriteLine(line2);
            Trace.WriteLine(line3);
        }

        private void PrintCalibrationParameters()
        {
            Trace.WriteLine("k1: " + _ioParams.DistortionCoeffs[0, 0].ToString());
            Trace.WriteLine("k2: " + _ioParams.DistortionCoeffs[1, 0].ToString());
            Trace.WriteLine("p1: " + _ioParams.DistortionCoeffs[2, 0].ToString());
            Trace.WriteLine("p2: " + _ioParams.DistortionCoeffs[3, 0].ToString());
            Trace.WriteLine("k3: " + _ioParams.DistortionCoeffs[4, 0].ToString());

            PrintIntrinsicMatrix();
        }
        #endregion
    }
}


это ошибка
Error	1	No overload for method 'CalibrateCamera' takes 6 arguments


Что я уже пробовал:

я пытался найти ответ здесь и погуглить его, но до сих пор не могу найти...

1 Ответов

Рейтинг:
1

OriginalGriff

Посмотрите на документацию: Калибровка камеры.Способ CalibrateCamera [^]- требуется 7 параметров, а не шесть.
Похоже, вы упускаете из виду критерии прекращения.