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


C# CvMat.GetReal1D方法代码示例

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


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

示例1: FindExtrinsicCameraParams2Cs


//.........这里部分代码省略.........
                CvMat _m = new CvMat(1, count, MatrixType.F64C2);

                ConvertPointsHomogeneous(objectPoints, matM);
                ConvertPointsHomogeneous(imagePoints, _m);
                Convert(cameraMatrix, matA);

                if (!((rvec.ElemType == MatrixType.F64C1 || rvec.ElemType == MatrixType.F32C1) &&
                    (rvec.Rows == 1 || rvec.Cols == 1) && rvec.Rows * rvec.Cols * rvec.ElemChannels == 3))
                {
                    throw new ArgumentException();
                }
                if (!((tvec.ElemType == MatrixType.F64C1 || tvec.ElemType == MatrixType.F32C1) &&
                    (tvec.Rows == 1 || tvec.Cols == 1) && tvec.Rows * tvec.Cols * tvec.ElemChannels == 3))
                {
                    throw new ArgumentException();
                }

                CvMat _mn = new CvMat(1, count, MatrixType.F64C2);
                CvMat _Mxy = new CvMat(1, count, MatrixType.F64C2);

                // normalize image points
                // (unapply the intrinsic matrix transformation and distortion)
                UndistortPoints_(_m, _mn, matA, distCoeffs, null, _Ar);

                if (useExtrinsicGuess)
                {
                    using (CvMat _r_temp = new CvMat(rvec.Rows, rvec.Cols, MatrixType.F64C1))
                    using (CvMat _t_temp = new CvMat(tvec.Rows, tvec.Cols, MatrixType.F64C1))
                    {
                        Convert(rvec, _r_temp);
                        Convert(tvec, _t_temp);
                        for (int i = 0; i < Math.Max(rvec.Rows, rvec.Cols); i++)
                        {
                            param[i] = _r_temp.GetReal1D(i);
                            param[i + 3] = _t_temp.GetReal1D(i);
                        }
                    }
                }
                else
                {
                    CvScalar Mc = Avg(matM);
                    _Mc[0] = Mc.Val0;
                    _Mc[1] = Mc.Val1;
                    _Mc[2] = Mc.Val2;
                    Reshape(matM, matM, 1, count);
                    MulTransposed(matM, _MM, true, _Mc);
                    SVD(_MM, matW, null, matV, SVDFlag.ModifyA | SVDFlag.V_T);

                    // initialize extrinsic parameters
                    if (W[2] / W[1] < 1e-3 || count < 4)
                    {
                        // a planar structure case (all M's lie in the same plane)
                        double[] h = new double[9];
                        CvMat R_transform = matV;
                        CvMat T_transform = new CvMat(3, 1, MatrixType.F64C1);
                        CvMat matH = new CvMat(3, 3, MatrixType.F64C1, h);
                        CvMat _h1, _h2, _h3;

                        if (V[2] * V[2] + V[5] * V[5] < 1e-10)
                            SetIdentity(R_transform);

                        if (Det(R_transform) < 0)
                            Scale(R_transform, R_transform, -1);

                        //GEMM(R_transform, _Mc, -1, null, 0, T_transform, GemmOperation.B_T);
                        for (int r = 0; r < 3; r++)
开发者ID:jorik041,项目名称:opencvsharp,代码行数:67,代码来源:Cv_F.cs


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