当前位置: 首页>>代码示例>>C#>>正文


C# DenseMatrix.PointwiseDivide_NoNaN方法代码示例

本文整理汇总了C#中MathNet.Numerics.LinearAlgebra.Double.DenseMatrix.PointwiseDivide_NoNaN方法的典型用法代码示例。如果您正苦于以下问题:C# DenseMatrix.PointwiseDivide_NoNaN方法的具体用法?C# DenseMatrix.PointwiseDivide_NoNaN怎么用?C# DenseMatrix.PointwiseDivide_NoNaN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MathNet.Numerics.LinearAlgebra.Double.DenseMatrix的用法示例。


在下文中一共展示了DenseMatrix.PointwiseDivide_NoNaN方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_CameraMatrix_Jacobian

        public void Test_CameraMatrix_Jacobian()
        {
            PrepareCameraMatrix();
            var points = GenerateCalibrationPoints_Random();
            PrepareCalibrator(
                AddNoise(points, _varianceReal, _varianceImage));

            _calib.HomoPoints();
            //_calib.NormalizeImagePoints();
            // _calib.NormalizeRealPoints();
            _calib.CameraMatrix = _calib.FindLinearEstimationOfCameraMatrix();
            // _calib.FindNormalisedVariances();

            _eCM = _calib.CameraMatrix;
            for(int p = 0; p < _pointsCount; ++p)
            {
                var cp = points[p];
                Vector<double> rp = new DenseVector(4);
                rp[0] = cp.RealX;
                rp[1] = cp.RealY;
                rp[2] = cp.RealZ;
                rp[3] = 1.0;
                var imagePoint = _eCM * rp;

                Vector2 ip = new Vector2(imagePoint[0] / imagePoint[2], imagePoint[1] / imagePoint[2]);
                Assert.IsTrue((ip - cp.Img).Length() < 0.4);
            }

            _calib.DecomposeCameraMatrix();

            var miniAlg = _calib._miniAlg;
            _calib.PrepareMinimalisationAlg();
            miniAlg.Init();

            miniAlg.DoComputeJacobianNumerically = false;
            Matrix<double> testedJacobian = new DenseMatrix(miniAlg.MeasurementsVector.Count, miniAlg.ParametersVector.Count);
            miniAlg.ComputeJacobian(testedJacobian);

            miniAlg.DoComputeJacobianNumerically = true;
            Matrix<double> numericJacobian = new DenseMatrix(miniAlg.MeasurementsVector.Count, miniAlg.ParametersVector.Count);
            miniAlg.ComputeJacobian(numericJacobian);

            int size = testedJacobian.RowCount * testedJacobian.ColumnCount;
            double jacobian_diff = numericJacobian.PointwiseDivide_NoNaN(testedJacobian).FrobeniusNorm();
            Assert.IsTrue(Math.Abs(jacobian_diff - Math.Sqrt(size)) < Math.Sqrt(size) / 100.0 || // 1% diffrence max
                (numericJacobian - testedJacobian).FrobeniusNorm() < 1e-6,
                "Analitical and numeric jacobians differ");
        }
开发者ID:KFlaga,项目名称:Cam3D,代码行数:48,代码来源:CameraMatrixComputationTests.cs


注:本文中的MathNet.Numerics.LinearAlgebra.Double.DenseMatrix.PointwiseDivide_NoNaN方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。