本征3.3.4 Affine3f :: rotation获得错误的矩阵值

时间:2018-06-29 02:07:47

标签: c++ eigen eigen3

我正在使用特征3.3.4进行矩阵计算,并在x64发行模式下使用VS2010,代码为:

void foo(const Eigen::Affine3f& pose){
    cout<<">>>>>>>>>>>>foo\n"
        <<"pose:\n"<<pose.matrix()<<endl
        <<"pose.linear:\n"<<pose.linear()<<endl
        <<"pose.rotation:\n"<<pose.rotation()<<endl
        ;
}//foo

int main() {
    Eigen::Matrix3f R = Eigen::Matrix3f::Identity ();   // * AngleAxisf( pcl::deg2rad(-30.f), Vector3f::UnitX());
    Eigen::Vector3f t;
    t<<0.15,0.15,-0.6;
    Eigen::Affine3f pose = Eigen::Translation3f (t) * Eigen::AngleAxisf (R);
    cout<<"main\n"
        <<"R, t\n"<<R<<endl<<t<<endl
        <<"pose:\n"<<pose.matrix()<<endl
        <<"pose.linear:\n"<<pose.linear()<<endl
        <<"pose.rotation:\n"<<pose.rotation()<<endl
        ;
    foo(pose);
}

输出:

main
R, t
1 0 0
0 1 0
0 0 1
0.15
0.15
-0.6
pose:
   1    0    0 0.15
   0    1    0 0.15
   0    0    1 -0.6
   0    0    0    1
pose.linear:
1 0 0
0 1 0
0 0 1
pose.rotation:
1 0 0
0 1 0
0 0 1
>>>>>>>>>>>>foo
pose:
   1    0    0 0.15
   0    1    0 0.15
   0    0    1 -0.6
   0    0    0    1
pose.linear:
1 0 0
0 1 0
0 0 1
pose.rotation:
  1.1529e+016             0             0  //<--------WRONG, it should be an Identity Matrix
            0 -1.07373e+008             0
            0             0 -1.07373e+008

pose.rotation的输出最终给出了错误的矩阵值,这对我来说似乎是内存访问冲突。

我不知道这是否是由于本征受其他库文件的影响(由于本征仅用于标头,所以似乎不可能),我的库依赖项是:

g2o_core.lib
g2o_stuff.lib
g2o_types_slam3d.lib
g2o_solver_cholmod.lib
libblas.lib
liblapack.lib
libamd.lib
libcamd.lib
libccolamd.lib
libcholmod.lib
libcolamd.lib
suitesparseconfig.lib
metis.lib
D:\Program Files\PCL 1.6.0\3rdParty\Boost\lib\libboost_system-vc100-mt-1_49.lib
D:\Program Files\PCL 1.6.0\3rdParty\Boost\lib\libboost_filesystem-vc100-mt-1_49.lib
D:\Program Files\PCL 1.6.0\3rdParty\Boost\lib\libboost_thread-vc100-mt-1_49.lib
D:\Program Files\PCL 1.6.0\3rdParty\Boost\lib\libboost_date_time-vc100-mt-1_49.lib
D:\Program Files\PCL 1.6.0\3rdParty\Boost\lib\libboost_iostreams-vc100-mt-1_49.lib
D:\Program Files\PCL 1.6.0\3rdParty\Boost\lib\libboost_regex-vc100-mt-1_49.lib
delayimp.lib
..\..\lib\pcl_io_release.lib
..\..\lib\pcl_gpu_utils_release.lib
..\..\lib\pcl_gpu_octree_release.lib
..\..\lib\pcl_filters_release.lib
D:\opencv249\build\x64\vc10\lib\opencv_videostab249.lib
D:\opencv249\build\x64\vc10\lib\opencv_ts249.lib
D:\opencv249\build\x64\vc10\lib\opencv_superres249.lib
D:\opencv249\build\x64\vc10\lib\opencv_stitching249.lib
D:\opencv249\build\x64\vc10\lib\opencv_contrib249.lib
..\..\lib\pcl_io_ply_release.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkWidgets.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkHybrid.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkexoIIc.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkVolumeRendering.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkRendering.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkGraphics.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkverdict.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkftgl.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkfreetype.lib
D:\Qt\qt-4.8.6-x64-msvc2010\lib\QtGui4.lib
D:\Qt\qt-4.8.6-x64-msvc2010\lib\QtSql4.lib
D:\Qt\qt-4.8.6-x64-msvc2010\lib\QtCore4.lib
opengl32.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkIO.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkDICOMParser.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkNetCDF_cxx.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkNetCDF.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkmetaio.lib
comctl32.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtksqlite.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkpng.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtktiff.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkzlib.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkjpeg.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkexpat.lib
vfw32.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkImaging.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkFiltering.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtkCommon.lib
D:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8\vtksys.lib
ws2_32.lib
wsock32.lib
D:\Anaconda2\Library\lib\png.lib
D:\Program Files\OpenNI154\Lib64\openNI64.lib
..\..\lib\pcl_gpu_containers_release.lib
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\lib\x64\cudart_static.lib
..\..\lib\pcl_sample_consensus_release.lib
..\..\lib\pcl_search_release.lib
..\..\lib\pcl_octree_release.lib
..\..\lib\pcl_kdtree_release.lib
..\..\lib\pcl_common_release.lib
D:\Program Files\PCL 1.6.0\3rdParty\FLANN\lib\flann_s.lib
D:\opencv249\build\x64\vc10\lib\opencv_nonfree249.lib
D:\opencv249\build\x64\vc10\lib\opencv_ocl249.lib
D:\opencv249\build\x64\vc10\lib\opencv_gpu249.lib
D:\opencv249\build\x64\vc10\lib\opencv_photo249.lib
D:\opencv249\build\x64\vc10\lib\opencv_objdetect249.lib
D:\opencv249\build\x64\vc10\lib\opencv_legacy249.lib
D:\opencv249\build\x64\vc10\lib\opencv_video249.lib
D:\opencv249\build\x64\vc10\lib\opencv_ml249.lib
D:\opencv249\build\x64\vc10\lib\opencv_calib3d249.lib
D:\opencv249\build\x64\vc10\lib\opencv_features2d249.lib
D:\opencv249\build\x64\vc10\lib\opencv_highgui249.lib
D:\opencv249\build\x64\vc10\lib\opencv_imgproc249.lib
D:\opencv249\build\x64\vc10\lib\opencv_flann249.lib
D:\opencv249\build\x64\vc10\lib\opencv_core249.lib

0 个答案:

没有答案