예제 #1
0
        public void UpdateFromOpenCV(Mat sensorMat, MatOfDouble distCoeffsMat, int width, int height, float rmsError)
        {
            if (distortionCoeffs == null || distCoeffsMat.IsDisposed || distortionCoeffs.Length != distCoeffsMat.total())
            {
                distortionCoeffs = new double[distCoeffsMat.total()];
            }

            fx            = sensorMat.ReadValue(0, 0) / (double)width;
            fy            = sensorMat.ReadValue(1, 1) / (double)height;
            cx            = sensorMat.ReadValue(0, 2) / (double)width;
            cy            = sensorMat.ReadValue(1, 2) / (double)height;
            aspect        = width / (double)height;
            this.rmsError = rmsError;

            for (int i = 0; i < distortionCoeffs.Length; i++)
            {
                distortionCoeffs[i] = distCoeffsMat.ReadValue(i);
            }
        }