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


C# DenseVector.QuaternionToRotation方法代码示例

本文整理汇总了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)));
 }
开发者ID:kamal-kr,项目名称:RGBLocalization,代码行数:10,代码来源:Pose3D.cs

示例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);
        }
开发者ID:kamal-kr,项目名称:RGBLocalization,代码行数:36,代码来源:Pose3DTests.cs


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