本文整理汇总了C#中MathNet.Numerics.LinearAlgebra.Double.DenseVector.QuaternionToRotation方法的典型用法代码示例。如果您正苦于以下问题:C# DenseVector.QuaternionToRotation方法的具体用法?C# DenseVector.QuaternionToRotation怎么用?C# DenseVector.QuaternionToRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MathNet.Numerics.LinearAlgebra.Double.DenseVector
的用法示例。
在下文中一共展示了DenseVector.QuaternionToRotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DPixelToWorld
public static DenseMatrix DPixelToWorld(DenseVector poseQuaternion,
DenseVector posePosition,
DenseMatrix inverseCalibration,
DenseMatrix homogeneousPixels,
DenseMatrix depths)
{
return ((DenseMatrix)
poseQuaternion.QuaternionToRotation()
.Multiply(DPixelToWorld(inverseCalibration, homogeneousPixels, depths).Translate(posePosition)));
}
示例2: TestOpenCVProjection
public static void TestOpenCVProjection()
{
int numPoints = 1;
Matrix<double> worldPoints = DenseMatrix.CreateRandom(2, numPoints, new ContinuousUniform(100, 300));
worldPoints = worldPoints.InsertRow(2, DenseVector.CreateRandom(numPoints, new ContinuousUniform(500, 2000)));
var posePosition = new DenseVector(new double[] { 1000, 2000, 3000 });
var poseQuat = new DenseVector(new double[] { 0.4823661149, -0.009425591677, 0.8759094477, -0.004083401989 });
//var poseQuat = new DenseVector(new double[] { 1, 0, 0, 0 });
var extParameters = new Emgu.CV.ExtrinsicCameraParameters();
extParameters.RotationVector = new Emgu.CV.RotationVector3D();
extParameters.RotationVector.RotationMatrix = poseQuat.QuaternionToRotation().Inverse().ToEmguMatrix();
extParameters.TranslationVector = (-posePosition).ToColumnMatrix().ToEmguMatrix();
DenseMatrix calibrationMatrix = (DenseMatrix)Pose3D.CreateCalibrationMatrix(525, 320, 240);
var intParameters = new Emgu.CV.IntrinsicCameraParameters();
intParameters.IntrinsicMatrix = calibrationMatrix.ToEmguMatrix();
var openCVProjectedPoints =
Emgu.CV.CameraCalibration.ProjectPoints(
worldPoints.ColumnEnumerator().Select(col => new MCvPoint3D32f((float)col.Item2[0], (float)col.Item2[1], (float)col.Item2[2])).ToArray(),
extParameters,
intParameters);
Console.WriteLine("Open CV Projeted points: \n{0:0.00}", openCVProjectedPoints.ToMatrix(p => new double[] { p.X, p.Y }).Transpose());
var myProjectedPoints = Pose3D.WorldToImagePoints(
worldPoints,
calibrationMatrix,
posePosition,
poseQuat.QuaternionToRotation());
Console.WriteLine("My Projeted points: \n{0:0.00}", myProjectedPoints);
}