本文整理汇总了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");
}