Giter VIP home page Giter VIP logo

slambook2's Introduction

Slambook2

titlepage

Welcome to Slambook 2nd Edition! This is the codebase of our book. Here are some relavant links if you need them:

Email me if you have any questions: gao.xiang.thu at gmail dot com. Or send a issue at github if your question is about the code.

Errata will be updated at this code base.

Hope you like this book.

BaiduYun backup link in case your github is very slow (common in China): here


视觉SLAM十四讲:从理论到实践 第二版

欢迎来到视觉SLAM十四讲:从理论到实践。这里存放本书对应的代码文件。以下是一些可能对你有用的链接:

如果您对书籍内容有疑问,请给我发送邮件。如果对代码有疑问,请点击上方的issue链接新建issues。我会不定期查看和回复(抱歉我可能无法回复所有问题和邮件)。

勘误表会更新到代码库中。

希望您喜欢本书。

本代码的百度云备份(如果您的github速度非常慢)下载链接.

slambook2's People

Contributors

andrewpak avatar collenjones avatar gaoxiang12 avatar hanzheteng avatar hatcherrobotics avatar keineahnung2345 avatar lgystoic avatar niebayes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slambook2's Issues

可否请作者制作一个docker简化配置?

作者您好,我们同学们在使用你这本书的时候,一个痛点便是配置环境,花费了很多时间,可否请您配置好一个可以运行书中示例的docker环境,供我们下载呢?万分感谢!

ch5 imageBasics程序make时报错

在做第五讲的OpenCV基本操作的实践,程序make时报错如下:

[ 50%] Building CXX object CMakeFiles/imageBasics.dir/imageBasics.cpp.o
[100%] Linking CXX executable imageBasics
/usr/bin/ld: 找不到 -lEigen3::Eigen
collect2: error: ld returned 1 exit status
CMakeFiles/imageBasics.dir/build.make:155: recipe for target 'imageBasics' failed
make[2]: *** [imageBasics] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/imageBasics.dir/all' failed
make[1]: *** [CMakeFiles/imageBasics.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

一开始有更多的类似/usr/bin/ld: 找不到 -l*** 的错误,但是通过建立相应的.so文件软链接的方式消除了。不过这个Eigen库不是没有.so文件吗,实在不知道怎么解决了。还望知道的朋友解答一下

When will book version 2 be released?

Hello Dr. Gao,

Thank you for bringing vSLAM accessible to a variety of audience. I'm wondering when the second version draft will be released? Can't wait to read it!

ch13/frontend类

您好,在首帧位姿进行初始化时,通过输出发现首帧变换矩阵(3*4)为0,1,0,0,0,0,1,0,0,0,0,1而不是1,0,0,0,0,1,0,0,0,0,1,0。这是您有意为之吗?另外,我从相对变量relative_motion_开始出现也没有找到它是什么时候第一次初始化的。麻烦您了

ch12中dense_mapping.cpp中代码注释有误

ch12的dense_mapping.cpp中的第390行代码
// [ f_cur^T f_ref, -f2^T f2 ] [d_cur] = [f2^T t ]
下面的代码跟这一行的公式没有对应起来,仔细一看才发现在这一行注释中,第一个中括号内的 f_cur应为f2,也就是下面这样
// [ f2^T f_ref, -f2^T f2 ] [d_cur] = [f2^T t ]
这样才对吧

English version?

Hello!

Thank you for your work. I want to ask if the English version of the slambook2 will be available?

关于第三方库Pangolin 编译错误问题

mkdir build
cd build
cmake ..
cmake --build .

出现如下错误:
[ 73%] Linking CXX shared library libpangolin.so
[ 73%] Built target pangolin
Scanning dependencies of target HelloPangolin
[ 73%] Building CXX object examples/HelloPangolin/CMakeFiles/HelloPangolin.dir/main.cpp.o
[ 74%] Linking CXX executable HelloPangolin
/home/deeptuuk/conda/lib/libtbb.so.2: undefined reference to __cxa_init_primary_exception@CXXABI_1.3.11' /home/deeptuuk/conda/lib/libtbb.so.2: undefined reference to std::__exception_ptr::exception_ptr::exception_ptr(void*)@CXXABI_1.3.11'
collect2: error: ld returned 1 exit status
examples/HelloPangolin/CMakeFiles/HelloPangolin.dir/build.make:113: recipe for target 'examples/HelloPangolin/HelloPangolin' failed
make[2]: *** [examples/HelloPangolin/HelloPangolin] Error 1
CMakeFiles/Makefile2:268: recipe for target 'examples/HelloPangolin/CMakeFiles/HelloPangolin.dir/all' failed
make[1]: *** [examples/HelloPangolin/CMakeFiles/HelloPangolin.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

Ch12 plc安装过程中,依赖库冲突,导致部分软件包无法被安装

sudo apt-get install libpcl-dev pcl-tools
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
pcl-tools 已经是最新版 (1.8.1+dfsg1-2ubuntu2.18.04.1)。
有一些软件包无法被安装。
下列软件包有未满足的依赖关系:
libpcl-dev : 依赖: libvtk6-dev 但是它将不会被安装
依赖: libvtk6-qt-dev 但是它将不会被安装

E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系

使用了 sudo aptitude install libpcl-dev 解决方案如下:
删除 下列软件包:

  1. libvtk7-dev [7.1.1+dfsg1-2 (bionic, now)] 
    
  2. libvtk7-java [7.1.1+dfsg1-2 (bionic, now)]
    
  3. libvtk7-jni [7.1.1+dfsg1-2 (bionic, now)] 
    

删除过一次,但是还是这样。。。并且还安装了一大堆其他的库文件。。
求助:如何解决?

pose_estimation_3d2d.cpp输出格式控制的bug

pose_estimation_3d2d.cpp源文件:

233     pose = Sophus::SE3d::exp(dx) * pose;
234     lastCost = cost;
235 
236     cout << "iteration " << iter << " cost=" << cout.precision(12) << cost << endl;

236行的cout.precision函数的返回值是函数调用之前的精度值,并不是返回*this,结果这个返回值和后面的cost值混合在一起输出了:

iteration 0 cost=644765.3537799
iteration 1 cost=12727.290187745
iteration 2 cost=12319.869976045
iteration 3 cost=12319.609322181
iteration 4 cost=12319.608618764

实际的输出应该是这样:

iteration 0 cost=44765.3537799
iteration 1 cost=727.290187745
iteration 2 cost=319.869976045
iteration 3 cost=319.609322181
iteration 4 cost=319.608618764

CH3 关于eigenMatrix.cpp的可能的问题

你好 高博,
我在实验eigenMatrix.cpp代码时,发现两个疑惑的问题,若自己搞错了,也请大家指正~

1

Matrix<double, MATRIX_SIZE, MATRIX_SIZE> matrix_NN
      = MatrixXd::Random(MATRIX_SIZE, MATRIX_SIZE);

我运行多次,发现这里返回的matrix_NN都一样,然后根据这里,得到了真正每次都随机生成不同矩阵

2

matrix_NN = matrix_NN * matrix_NN.transpose();  // 保证半正定

我记得实对称矩阵不一定半正定或正定吧?
但是在多次运行后(不同的matrix_NN和v_Nd),发现这里后面的cholesky分解来解方程也一直没问题,不是只有正定矩阵才能用该方法吗?

谢谢!

The ply file dumped by the ch9 example code cannot be opened

Hi, thanks for your book.

The example code in ch9 cannot dump a PLY file with a correct format, so that the cloudcompare software cannot open it.

You missed a necessary space here.

    // Export extrinsic data (i.e. camera centers) as green points.
    double angle_axis[3];
    double center[3];
    for (int i = 0; i < num_cameras(); ++i) {
        const double *camera = cameras() + camera_block_size() * i;
        CameraToAngelAxisAndCenter(camera, angle_axis, center);
        of << center[0] << ' ' << center[1] << ' ' << center[2]
           << "0 255 0" << '\n';
    // ~~~~~~~^~~~~~~~~~~~~~~~~~~~~ add a space before `0 255 0`
    }

Ch3与Ch4两个例子中Quaterniond类型的初始化不一致

Ch3中plotTrajectory.cpp中第24行的Quaterniond的顺序是qw, qx, qy, qz,但是Ch4中trajectoryError.cpp中第51行,Quaterniond顺序是qx, qy, qz, qw。而实际Quaternion.h头文件中定义的顺序是Quaternion(const Scalar& w, const Scalar& x, const Scalar& y, const Scalar& z)

但是奇怪的是把Ch4中的qw的顺序来回调整,得出来的轨迹似乎是一样的?

Questions about ch13

Hello, I have looked over the source code of the project in ch13 and have two questions:

  1. First question is about the calculation of baseline. Why ist.sqauredNorm() used to calculate the baseline instead of t.norm()?

  2. Second question is about Map::InsertKeyFrame(). Why check if frame_id_ exists when keyframes_ actually contains keyframe_id_?

ch5 小建議

//undistortImage
double x = (u - cx) / fx, y = (v - cy) / fy;
double r = sqrt(x * x + y * y);
double x_distorted = x * (1 + k1 * r * r + k2 * r * r * r * r) + 2 * p1 * x * y + p2 * (r * r + 2 * x * x);
double y_distorted = y * (1 + k1 * r * r + k2 * r * r * r * r) + p1 * (r * r + 2 * y * y) + 2 * p2 * x * y;
double u_distorted = fx * x_distorted + cx;
double v_distorted = fy * y_distorted + cy;

//Perspective
//stereoVIsion.cpp

double x = (u - cx) / fx;
double y = (v - cy) / fy;
double depth = fx * b / (disparity.at<float>(v, u));

point[0] = x * depth;
point[1] = y * depth;
point[2] = depth;
 // 如果沒有搞錯的話這邊乘depth   => [~P]c相機座標 

slam2 book page 102

得到P的歸一化座標  Pc = [X / Z,  Y / Z, 1]

slam2 book page 105

計算像素的3D相機座標,生成點雲(Point Cloud)

slam2 book page 115

座標關係提到的:
通過雙目相機的幾何模型把它變換到相機的3D空間中
視差數據結合了相機內參 baseline即確定各點在三維空間中的位置

能不能在這兩段code後面,補個小說明解釋座標關係差別加深印象?
後面3個例子真的超好!!!

ch3 useGeometry在ubuntu18.04,clion下进行编译出错

====================[ Build | eigenGeometry | Debug ]===========================
/snap/clion/82/bin/cmake/linux/bin/cmake --build /home/xhyu/slambook2/ch3/useGeometry/cmake-build-debug --target eigenGeometry -- -j 6
Scanning dependencies of target eigenGeometry
[ 33%] Building CXX object CMakeFiles/eigenGeometry.dir/home/xhyu/slambook2/ch3/examples/coordinateTransform.cpp.o
[ 66%] Linking CXX executable eigenGeometry
CMakeFiles/eigenGeometry.dir/home/xhyu/slambook2/ch3/examples/coordinateTransform.cpp.o: In function main': /usr/include/eigen3/Eigen/src/Core/IO.h:129: multiple definition of main'
CMakeFiles/eigenGeometry.dir/eigenGeometry.cpp.o:/home/xhyu/slambook2/ch3/useGeometry/eigenGeometry.cpp:13: first defined here
collect2: error: ld returned 1 exit status
CMakeFiles/eigenGeometry.dir/build.make:98: recipe for target 'eigenGeometry' failed
make[3]: *** [eigenGeometry] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/eigenGeometry.dir/all' failed
make[2]: *** [CMakeFiles/eigenGeometry.dir/all] Error 2
CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/eigenGeometry.dir/rule' failed
make[1]: *** [CMakeFiles/eigenGeometry.dir/rule] Error 2
Makefile:118: recipe for target 'eigenGeometry' failed
make: *** [eigenGeometry] Error 2

错误提示如上,然后经过阅读个人认为是main函数重复定义,另外在cmakelist中直接将两个文件都生成了可执行文件,冲突了,修改cmakelist或者修改任意一个main函数的文件名可以解决该问题,但是本人刚刚开始学习,所以不敢肯定,恳求大佬指点

ch7 3d3d程序运行不对

calling bundle adjustment
iteration= 0 chi2= 1.815772 time= 2.3413e-05 cumTime= 2.3413e-05 edges= 75 schur= 0 lambda= 0.000787 levenbergIter= 1
iteration= 1 chi2= 1.815193 time= 1.2752e-05 cumTime= 3.6165e-05 edges= 75 schur= 0 lambda= 0.000524 levenbergIter= 1
iteration= 2 chi2= 1.815193 time= 1.0919e-05 cumTime= 4.7084e-05 edges= 75 schur= 0 lambda= 0.000350 levenbergIter= 1
iteration= 3 chi2= 1.815193 time= 1.0669e-05 cumTime= 5.7753e-05 edges= 75 schur= 0 lambda= 0.000233 levenbergIter= 1
iteration= 4 chi2= 1.815193 time= 1.0468e-05 cumTime= 6.8221e-05 edges= 75 schur= 0 lambda= 0.000155 levenbergIter= 1
iteration= 5 chi2= 1.815193 time= 1.0481e-05 cumTime= 7.8702e-05 edges= 75 schur= 0 lambda= 0.000104 levenbergIter= 1
iteration= 6 chi2= 1.815193 time= 2.1083e-05 cumTime= 9.9785e-05 edges= 75 schur= 0 lambda= 0.070714 levenbergIter= 5
iteration= 7 chi2= 1.815193 time= 1.112e-05 cumTime= 0.000110905 edges= 75 schur= 0 lambda= 0.047143 levenbergIter= 1
iteration= 8 chi2= 1.815193 time= 2.3951e-05 cumTime= 0.000134856 edges= 75 schur= 0 lambda= 12654823.401608 levenbergIter= 7
optimization costs time: 0.00041749 seconds.

after optimization:
T=
0.997207 0.0583427 -0.046639 0.137988
-0.0578775 0.99826 0.0112663 -0.065517
0.0472151 -0.00853546 0.998848 -0.0298169
0 0 0 1
double free or corruption (out)
已放弃 (核心已转储)

不太明白为啥运行失败
单独下载了第一版第七章代码,发现可以运行成功
有个疑问是 为啥第一版的代码里面 jacobian的顺序把单位阵放后面了?按照SE(3)扰动模型不是应该在前面吗?

ch13 运行时出现段错误(核心已转储)

查看产生的core文件,给出如下提示:
Core was generated by `bin/run_kitti_stereo'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f80847135da in cv::FileNode::ptr() [clone .localalias.329] ()
from /usr/local/lib/libopencv_core.so.4.1

小白一枚,不知道是什么原因,还请赐教

Ch4 eigen3新老版本冲突

你好高博
之前在slambook1里使用的是sophus的.h老版本。在Slambook2里使用的sophus是hpp版本的。这hpp版本的sophus需要更高版本的eigen3。现在我的Ubuntu16.04上安装了eigen3.2和eigen3.3两个版本,并且修改了sophus的cmakelists(set了eigen3.3的路径)使得新版本的sophus可以成功找到新版本eigen3并编译安装成功。但是在运行ch4时还是会在编译时报错:
canning dependencies of target useSophus make[3]: *** No rule to make target '/home/lincoln/Documents/Sophus/build/libSophus.so', needed by 'useSophus'. Stop. make[3]: *** Waiting for unfinished jobs.... [ 50%] Building CXX object CMakeFiles/useSophus.dir/useSophus.cpp.o In file included from /usr/local/include/sophus/so3.hpp:8:0, from /usr/local/include/sophus/se3.hpp:7, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:5: /usr/local/include/sophus/so2.hpp:101:40: error: ‘ScalarBinaryOpTraits’ in namespace ‘Eigen’ does not name a template type using ReturnScalar = typename Eigen::ScalarBinaryOpTraits< ^ /usr/local/include/sophus/so2.hpp:105:26: error: ‘ReturnScalar’ was not declared in this scope using SO2Product = SO2<ReturnScalar<OtherDerived>>; ^ /usr/local/include/sophus/so2.hpp:105:39: error: template argument 1 is invalid using SO2Product = SO2<ReturnScalar<OtherDerived>>; ^ /usr/local/include/sophus/so2.hpp:108:32: error: ‘ReturnScalar’ was not declared in this scope using PointProduct = Vector2<ReturnScalar<PointDerived>>; ^ /usr/local/include/sophus/so2.hpp:108:45: error: template argument 1 is invalid using PointProduct = Vector2<ReturnScalar<PointDerived>>; ^ /usr/local/include/sophus/so2.hpp:111:43: error: ‘ReturnScalar’ was not declared in this scope using HomogeneousPointProduct = Vector3<ReturnScalar<HPointDerived>>; ^ /usr/local/include/sophus/so2.hpp:111:56: error: template argument 1 is invalid using HomogeneousPointProduct = Vector3<ReturnScalar<HPointDerived>>; ^ /usr/local/include/sophus/so2.hpp:209:15: error: ‘SO2Product’ does not name a type SOPHUS_FUNC SO2Product<OtherDerived> operator*( ^ /usr/local/include/sophus/so2.hpp:244:15: error: ‘PointProduct’ does not name a type SOPHUS_FUNC PointProduct<PointDerived> operator*( ^ /usr/local/include/sophus/so2.hpp:260:15: error: ‘HomogeneousPointProduct’ does not name a type SOPHUS_FUNC HomogeneousPointProduct<HPointDerived> operator*( ^ /usr/local/include/sophus/so2.hpp:284:38: error: ‘ReturnScalar’ was not declared in this scope std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ /usr/local/include/sophus/so2.hpp:284:51: error: template argument 2 is invalid std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ /usr/local/include/sophus/so2.hpp:284:63: error: template argument 1 is invalid std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ /usr/local/include/sophus/so2.hpp:284:75: error: ‘type’ in namespace ‘::’ does not name a type std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ In file included from /usr/local/include/sophus/se3.hpp:7:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:5: /usr/local/include/sophus/so3.hpp:105:40: error: ‘ScalarBinaryOpTraits’ in namespace ‘Eigen’ does not name a template type using ReturnScalar = typename Eigen::ScalarBinaryOpTraits< ^ /usr/local/include/sophus/so3.hpp:109:26: error: ‘ReturnScalar’ was not declared in this scope using SO3Product = SO3<ReturnScalar<OtherDerived>>; ^ /usr/local/include/sophus/so3.hpp:109:39: error: template argument 1 is invalid using SO3Product = SO3<ReturnScalar<OtherDerived>>; ^ /usr/local/include/sophus/so3.hpp:112:32: error: ‘ReturnScalar’ was not declared in this scope using PointProduct = Vector3<ReturnScalar<PointDerived>>; ^ /usr/local/include/sophus/so3.hpp:112:45: error: template argument 1 is invalid using PointProduct = Vector3<ReturnScalar<PointDerived>>; ^ /usr/local/include/sophus/so3.hpp:115:43: error: ‘ReturnScalar’ was not declared in this scope using HomogeneousPointProduct = Vector4<ReturnScalar<HPointDerived>>; ^ /usr/local/include/sophus/so3.hpp:115:56: error: template argument 1 is invalid using HomogeneousPointProduct = Vector4<ReturnScalar<HPointDerived>>; ^ /usr/local/include/sophus/so3.hpp:324:15: error: ‘SO3Product’ does not name a type SOPHUS_FUNC SO3Product<OtherDerived> operator*( ^ /usr/local/include/sophus/so3.hpp:357:15: error: ‘PointProduct’ does not name a type SOPHUS_FUNC PointProduct<PointDerived> operator*( ^ /usr/local/include/sophus/so3.hpp:372:15: error: ‘HomogeneousPointProduct’ does not name a type SOPHUS_FUNC HomogeneousPointProduct<HPointDerived> operator*( ^ /usr/local/include/sophus/so3.hpp:394:38: error: ‘ReturnScalar’ was not declared in this scope std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ /usr/local/include/sophus/so3.hpp:394:51: error: template argument 2 is invalid std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ /usr/local/include/sophus/so3.hpp:394:63: error: template argument 1 is invalid std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ /usr/local/include/sophus/so3.hpp:394:75: error: ‘type’ in namespace ‘::’ does not name a type std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ In file included from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:5:0: /usr/local/include/sophus/se3.hpp:85:40: error: ‘ScalarBinaryOpTraits’ in namespace ‘Eigen’ does not name a template type using ReturnScalar = typename Eigen::ScalarBinaryOpTraits< ^ /usr/local/include/sophus/se3.hpp:89:26: error: ‘ReturnScalar’ was not declared in this scope using SE3Product = SE3<ReturnScalar<OtherDerived>>; ^ /usr/local/include/sophus/se3.hpp:89:39: error: template argument 1 is invalid using SE3Product = SE3<ReturnScalar<OtherDerived>>; ^ /usr/local/include/sophus/se3.hpp:92:32: error: ‘ReturnScalar’ was not declared in this scope using PointProduct = Vector3<ReturnScalar<PointDerived>>; ^ /usr/local/include/sophus/se3.hpp:92:45: error: template argument 1 is invalid using PointProduct = Vector3<ReturnScalar<PointDerived>>; ^ /usr/local/include/sophus/se3.hpp:95:43: error: ‘ReturnScalar’ was not declared in this scope using HomogeneousPointProduct = Vector4<ReturnScalar<HPointDerived>>; ^ /usr/local/include/sophus/se3.hpp:95:56: error: template argument 1 is invalid using HomogeneousPointProduct = Vector4<ReturnScalar<HPointDerived>>; ^ /usr/local/include/sophus/se3.hpp:308:15: error: ‘SE3Product’ does not name a type SOPHUS_FUNC SE3Product<OtherDerived> operator*( ^ /usr/local/include/sophus/se3.hpp:325:15: error: ‘PointProduct’ does not name a type SOPHUS_FUNC PointProduct<PointDerived> operator*( ^ /usr/local/include/sophus/se3.hpp:335:15: error: ‘HomogeneousPointProduct’ does not name a type SOPHUS_FUNC HomogeneousPointProduct<HPointDerived> operator*( ^ /usr/local/include/sophus/se3.hpp:359:38: error: ‘ReturnScalar’ was not declared in this scope std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ /usr/local/include/sophus/se3.hpp:359:51: error: template argument 2 is invalid std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ /usr/local/include/sophus/se3.hpp:359:63: error: template argument 1 is invalid std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ /usr/local/include/sophus/se3.hpp:359:75: error: ‘type’ in namespace ‘::’ does not name a type std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type> ^ /home/lincoln/Documents/slambook2/ch4/useSophus.cpp: In function ‘int main(int, char**)’: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:35:60: error: no match for ‘operator*’ (operand types are ‘Sophus::SO3<double>’ and ‘Sophus::SO3d {aka Sophus::SO3<double>}’) Sophus::SO3d SO3_updated = Sophus::SO3d::exp(update_so3) * SO3_R; ^ In file included from /usr/local/include/sophus/se3.hpp:7:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:5: /usr/local/include/sophus/so3.hpp:385:20: note: candidate: Sophus::SO3Base<Derived>::Line Sophus::SO3Base<Derived>::operator*(const Line&) const [with Derived = Sophus::SO3<double>; Sophus::SO3Base<Derived>::Line = Eigen::ParametrizedLine<double, 3, 0>; typename Eigen::internal::traits<T>::Scalar = double] SOPHUS_FUNC Line operator*(Line const& l) const { ^ /usr/local/include/sophus/so3.hpp:385:20: note: no known conversion for argument 1 from ‘Sophus::SO3d {aka Sophus::SO3<double>}’ to ‘const Line& {aka const Eigen::ParametrizedLine<double, 3, 0>&}’ In file included from /usr/local/include/Eigen/Core:70:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/include/c++/5/complex:386:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator*(const std::complex<_Tp>&, const std::complex<_Tp>&) operator*(const complex<_Tp>& __x, const complex<_Tp>& __y) ^ /usr/include/c++/5/complex:386:5: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:35:62: note: ‘Sophus::SO3<double>’ is not derived from ‘const std::complex<_Tp>’ Sophus::SO3d SO3_updated = Sophus::SO3d::exp(update_so3) * SO3_R; ^ In file included from /usr/local/include/Eigen/Core:70:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/include/c++/5/complex:395:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator*(const std::complex<_Tp>&, const _Tp&) operator*(const complex<_Tp>& __x, const _Tp& __y) ^ /usr/include/c++/5/complex:395:5: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:35:62: note: ‘Sophus::SO3<double>’ is not derived from ‘const std::complex<_Tp>’ Sophus::SO3d SO3_updated = Sophus::SO3d::exp(update_so3) * SO3_R; ^ In file included from /usr/local/include/Eigen/Core:70:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/include/c++/5/complex:404:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator*(const _Tp&, const std::complex<_Tp>&) operator*(const _Tp& __x, const complex<_Tp>& __y) ^ /usr/include/c++/5/complex:404:5: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:35:62: note: ‘Sophus::SO3d {aka Sophus::SO3<double>}’ is not derived from ‘const std::complex<_Tp>’ Sophus::SO3d SO3_updated = Sophus::SO3d::exp(update_so3) * SO3_R; ^ In file included from /usr/local/include/Eigen/Householder:24:0, from /usr/local/include/Eigen/QR:17, from /usr/local/include/Eigen/SVD:11, from /usr/local/include/Eigen/Geometry:15, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:4: /usr/local/include/Eigen/src/Householder/HouseholderSequence.h:439:99: note: candidate: template<class OtherDerived, class VectorsType, class CoeffsType, int Side> typename Eigen::internal::matrix_type_times_scalar_type<typename VectorsType::Scalar, OtherDerived>::Type Eigen::operator*(const Eigen::MatrixBase<Derived>&, const Eigen::HouseholderSequence<VectorsType, CoeffsType, Side>&) typename internal::matrix_type_times_scalar_type<typename VectorsType::Scalar,OtherDerived>::Type operator*(const MatrixBase<OtherDerived>& other, const HouseholderSequence<VectorsType,CoeffsType,Side>& h) ^ /usr/local/include/Eigen/src/Householder/HouseholderSequence.h:439:99: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:35:62: note: ‘Sophus::SO3<double>’ is not derived from ‘const Eigen::MatrixBase<Derived>’ Sophus::SO3d SO3_updated = Sophus::SO3d::exp(update_so3) * SO3_R; ^ In file included from /usr/local/include/Eigen/Core:397:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/local/include/Eigen/src/Core/Transpositions.h:350:1: note: candidate: template<class TranspositionsDerived, class MatrixDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::TranspositionsBase<TranspositionsDerived>&, const Eigen::MatrixBase<U>&) operator*(const TranspositionsBase<TranspositionsDerived> &transpositions, ^ /usr/local/include/Eigen/src/Core/Transpositions.h:350:1: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:35:62: note: ‘Sophus::SO3<double>’ is not derived from ‘const Eigen::TranspositionsBase<TranspositionsDerived>’ Sophus::SO3d SO3_updated = Sophus::SO3d::exp(update_so3) * SO3_R; ^ In file included from /usr/local/include/Eigen/Core:397:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/local/include/Eigen/src/Core/Transpositions.h:338:1: note: candidate: template<class MatrixDerived, class TranspositionsDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::MatrixBase<Derived>&, const Eigen::TranspositionsBase<TranspositionsDerived>&) operator*(const MatrixBase<MatrixDerived> &matrix, ^ /usr/local/include/Eigen/src/Core/Transpositions.h:338:1: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:35:62: note: ‘Sophus::SO3<double>’ is not derived from ‘const Eigen::MatrixBase<Derived>’ Sophus::SO3d SO3_updated = Sophus::SO3d::exp(update_so3) * SO3_R; ^ In file included from /usr/local/include/Eigen/Core:396:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/local/include/Eigen/src/Core/PermutationMatrix.h:558:1: note: candidate: template<class PermutationDerived, class MatrixDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::PermutationBase<PermutationDerived>&, const Eigen::MatrixBase<U>&) operator*(const PermutationBase<PermutationDerived> &permutation, ^ /usr/local/include/Eigen/src/Core/PermutationMatrix.h:558:1: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:35:62: note: ‘Sophus::SO3<double>’ is not derived from ‘const Eigen::PermutationBase<PermutationDerived>’ Sophus::SO3d SO3_updated = Sophus::SO3d::exp(update_so3) * SO3_R; ^ In file included from /usr/local/include/Eigen/Core:396:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/local/include/Eigen/src/Core/PermutationMatrix.h:546:1: note: candidate: template<class MatrixDerived, class PermutationDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::MatrixBase<Derived>&, const Eigen::PermutationBase<PermutationDerived>&) operator*(const MatrixBase<MatrixDerived> &matrix, ^ /usr/local/include/Eigen/src/Core/PermutationMatrix.h:546:1: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:35:62: note: ‘Sophus::SO3<double>’ is not derived from ‘const Eigen::MatrixBase<Derived>’ Sophus::SO3d SO3_updated = Sophus::SO3d::exp(update_so3) * SO3_R; ^ /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:58:60: error: no match for ‘operator*’ (operand types are ‘Sophus::SE3<double>’ and ‘Sophus::SE3d {aka Sophus::SE3<double>}’) Sophus::SE3d SE3_updated = Sophus::SE3d::exp(update_se3) * SE3_Rt; ^ In file included from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:5:0: /usr/local/include/sophus/se3.hpp:350:20: note: candidate: Sophus::SE3Base<Derived>::Line Sophus::SE3Base<Derived>::operator*(const Line&) const [with Derived = Sophus::SE3<double>; Sophus::SE3Base<Derived>::Line = Eigen::ParametrizedLine<double, 3, 0>; typename Eigen::internal::traits<T>::Scalar = double] SOPHUS_FUNC Line operator*(Line const& l) const { ^ /usr/local/include/sophus/se3.hpp:350:20: note: no known conversion for argument 1 from ‘Sophus::SE3d {aka Sophus::SE3<double>}’ to ‘const Line& {aka const Eigen::ParametrizedLine<double, 3, 0>&}’ In file included from /usr/local/include/Eigen/Core:70:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/include/c++/5/complex:386:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator*(const std::complex<_Tp>&, const std::complex<_Tp>&) operator*(const complex<_Tp>& __x, const complex<_Tp>& __y) ^ /usr/include/c++/5/complex:386:5: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:58:62: note: ‘Sophus::SE3<double>’ is not derived from ‘const std::complex<_Tp>’ Sophus::SE3d SE3_updated = Sophus::SE3d::exp(update_se3) * SE3_Rt; ^ In file included from /usr/local/include/Eigen/Core:70:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/include/c++/5/complex:395:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator*(const std::complex<_Tp>&, const _Tp&) operator*(const complex<_Tp>& __x, const _Tp& __y) ^ /usr/include/c++/5/complex:395:5: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:58:62: note: ‘Sophus::SE3<double>’ is not derived from ‘const std::complex<_Tp>’ Sophus::SE3d SE3_updated = Sophus::SE3d::exp(update_se3) * SE3_Rt; ^ In file included from /usr/local/include/Eigen/Core:70:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/include/c++/5/complex:404:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator*(const _Tp&, const std::complex<_Tp>&) operator*(const _Tp& __x, const complex<_Tp>& __y) ^ /usr/include/c++/5/complex:404:5: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:58:62: note: ‘Sophus::SE3d {aka Sophus::SE3<double>}’ is not derived from ‘const std::complex<_Tp>’ Sophus::SE3d SE3_updated = Sophus::SE3d::exp(update_se3) * SE3_Rt; ^ In file included from /usr/local/include/Eigen/Householder:24:0, from /usr/local/include/Eigen/QR:17, from /usr/local/include/Eigen/SVD:11, from /usr/local/include/Eigen/Geometry:15, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:4: /usr/local/include/Eigen/src/Householder/HouseholderSequence.h:439:99: note: candidate: template<class OtherDerived, class VectorsType, class CoeffsType, int Side> typename Eigen::internal::matrix_type_times_scalar_type<typename VectorsType::Scalar, OtherDerived>::Type Eigen::operator*(const Eigen::MatrixBase<Derived>&, const Eigen::HouseholderSequence<VectorsType, CoeffsType, Side>&) typename internal::matrix_type_times_scalar_type<typename VectorsType::Scalar,OtherDerived>::Type operator*(const MatrixBase<OtherDerived>& other, const HouseholderSequence<VectorsType,CoeffsType,Side>& h) ^ /usr/local/include/Eigen/src/Householder/HouseholderSequence.h:439:99: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:58:62: note: ‘Sophus::SE3<double>’ is not derived from ‘const Eigen::MatrixBase<Derived>’ Sophus::SE3d SE3_updated = Sophus::SE3d::exp(update_se3) * SE3_Rt; ^ In file included from /usr/local/include/Eigen/Core:397:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/local/include/Eigen/src/Core/Transpositions.h:350:1: note: candidate: template<class TranspositionsDerived, class MatrixDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::TranspositionsBase<TranspositionsDerived>&, const Eigen::MatrixBase<U>&) operator*(const TranspositionsBase<TranspositionsDerived> &transpositions, ^ /usr/local/include/Eigen/src/Core/Transpositions.h:350:1: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:58:62: note: ‘Sophus::SE3<double>’ is not derived from ‘const Eigen::TranspositionsBase<TranspositionsDerived>’ Sophus::SE3d SE3_updated = Sophus::SE3d::exp(update_se3) * SE3_Rt; ^ In file included from /usr/local/include/Eigen/Core:397:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/local/include/Eigen/src/Core/Transpositions.h:338:1: note: candidate: template<class MatrixDerived, class TranspositionsDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::MatrixBase<Derived>&, const Eigen::TranspositionsBase<TranspositionsDerived>&) operator*(const MatrixBase<MatrixDerived> &matrix, ^ /usr/local/include/Eigen/src/Core/Transpositions.h:338:1: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:58:62: note: ‘Sophus::SE3<double>’ is not derived from ‘const Eigen::MatrixBase<Derived>’ Sophus::SE3d SE3_updated = Sophus::SE3d::exp(update_se3) * SE3_Rt; ^ In file included from /usr/local/include/Eigen/Core:396:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/local/include/Eigen/src/Core/PermutationMatrix.h:558:1: note: candidate: template<class PermutationDerived, class MatrixDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::PermutationBase<PermutationDerived>&, const Eigen::MatrixBase<U>&) operator*(const PermutationBase<PermutationDerived> &permutation, ^ /usr/local/include/Eigen/src/Core/PermutationMatrix.h:558:1: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:58:62: note: ‘Sophus::SE3<double>’ is not derived from ‘const Eigen::PermutationBase<PermutationDerived>’ Sophus::SE3d SE3_updated = Sophus::SE3d::exp(update_se3) * SE3_Rt; ^ In file included from /usr/local/include/Eigen/Core:396:0, from /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:3: /usr/local/include/Eigen/src/Core/PermutationMatrix.h:546:1: note: candidate: template<class MatrixDerived, class PermutationDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::MatrixBase<Derived>&, const Eigen::PermutationBase<PermutationDerived>&) operator*(const MatrixBase<MatrixDerived> &matrix, ^ /usr/local/include/Eigen/src/Core/PermutationMatrix.h:546:1: note: template argument deduction/substitution failed: /home/lincoln/Documents/slambook2/ch4/useSophus.cpp:58:62: note: ‘Sophus::SE3<double>’ is not derived from ‘const Eigen::MatrixBase<Derived>’ Sophus::SE3d SE3_updated = Sophus::SE3d::exp(update_se3) * SE3_Rt; ^ CMakeFiles/useSophus.dir/build.make:62: recipe for target 'CMakeFiles/useSophus.dir/useSophus.cpp.o' failed make[3]: *** [CMakeFiles/useSophus.dir/useSophus.cpp.o] Error 1 CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/useSophus.dir/all' failed make[2]: *** [CMakeFiles/useSophus.dir/all] Error 2 CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/useSophus.dir/rule' failed make[1]: *** [CMakeFiles/useSophus.dir/rule] Error 2 Makefile:118: recipe for target 'useSophus' failed make: *** [useSophus] Error 2
从报错内容看,ch4的useSophus虽然成功链接到sophus却并没有成功连接到eigen3.3。请问高博该如何解决这个问题

关于CH3编译错误问题

在ch3中建立build文件并对其进行cmake和make,make后出错如下:
error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \

我在CMAKESETListe.txt添加了( CMAKE_CXX_FLAGS "-std=c++11 -O3"),重新创建build和编译仍出现错误

视频问题

hi,xiang,

已经买了您的新书, 想找个网上十四讲的视频 对应着看 学的会快一些, 

现在好像不全了 我只找到了部分的视频 能不能私信发个 baidu pan 的 link 给我 先谢谢啦。

ch07/orb_self.cpp的代码笔误

第375行中
int idx_pq = i * 8 + k;
是否应该为
int idx_pq = i * 32 + k;

另外问一下,代码中的ORB_pattern[256 * 4]是否就是选取的特征点附近随机像素?可是这里是人为输入的,是有其他特殊含义吗?
另外书中有个笔误,就不另开issue了。p68倒数第二行的Panglin少了一个o。

高老師您好 直接在ch5文件夾裏面 新建build 然後進入 cmake .. ;make 回報很長的錯誤

lzw@lzw:/learn_slam/bookcode2/ch5/build$ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /opt/ros/kinetic (found version "3.3.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lzw/learn_slam/bookcode2/ch5/build
lzw@lzw:
/learn_slam/bookcode2/ch5/build$ make
Scanning dependencies of target undistortImage
[ 12%] Building CXX object imageBasics/CMakeFiles/undistortImage.dir/undistortImage.cpp.o
[ 25%] Linking CXX executable undistortImage
[ 25%] Built target undistortImage
Scanning dependencies of target imageBasics
[ 37%] Building CXX object imageBasics/CMakeFiles/imageBasics.dir/imageBasics.cpp.o
[ 50%] Linking CXX executable imageBasics
[ 50%] Built target imageBasics
Scanning dependencies of target stereoVision
[ 62%] Building CXX object stereo/CMakeFiles/stereoVision.dir/stereoVision.cpp.o
[ 75%] Linking CXX executable stereoVision
[ 75%] Built target stereoVision
Scanning dependencies of target joinMap
[ 87%] Building CXX object rgbd/CMakeFiles/joinMap.dir/joinMap.cpp.o
In file included from /usr/local/include/sophus/so3.hpp:8:0,
from /usr/local/include/sophus/se3.hpp:7,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:
/usr/local/include/sophus/so2.hpp:106:40: error: ‘ScalarBinaryOpTraits’ in namespace ‘Eigen’ does not name a template type
using ReturnScalar = typename Eigen::ScalarBinaryOpTraits<
^
/usr/local/include/sophus/so2.hpp:110:26: error: ‘ReturnScalar’ was not declared in this scope
using SO2Product = SO2<ReturnScalar>;
^
/usr/local/include/sophus/so2.hpp:110:39: error: template argument 1 is invalid
using SO2Product = SO2<ReturnScalar>;
^
/usr/local/include/sophus/so2.hpp:113:32: error: ‘ReturnScalar’ was not declared in this scope
using PointProduct = Vector2<ReturnScalar>;
^
/usr/local/include/sophus/so2.hpp:113:45: error: template argument 1 is invalid
using PointProduct = Vector2<ReturnScalar>;
^
/usr/local/include/sophus/so2.hpp:116:43: error: ‘ReturnScalar’ was not declared in this scope
using HomogeneousPointProduct = Vector3<ReturnScalar>;
^
/usr/local/include/sophus/so2.hpp:116:56: error: template argument 1 is invalid
using HomogeneousPointProduct = Vector3<ReturnScalar>;
^
/usr/local/include/sophus/so2.hpp:214:15: error: ‘SO2Product’ does not name a type
SOPHUS_FUNC SO2Product operator*(
^
/usr/local/include/sophus/so2.hpp:249:15: error: ‘PointProduct’ does not name a type
SOPHUS_FUNC PointProduct operator*(
^
/usr/local/include/sophus/so2.hpp:265:15: error: ‘HomogeneousPointProduct’ does not name a type
SOPHUS_FUNC HomogeneousPointProduct operator*(
^
/usr/local/include/sophus/so2.hpp:289:38: error: ‘ReturnScalar’ was not declared in this scope
std::is_same<Scalar, ReturnScalar>::value>::type>
^
/usr/local/include/sophus/so2.hpp:289:51: error: template argument 2 is invalid
std::is_same<Scalar, ReturnScalar>::value>::type>
^
/usr/local/include/sophus/so2.hpp:289:63: error: template argument 1 is invalid
std::is_same<Scalar, ReturnScalar>::value>::type>
^
/usr/local/include/sophus/so2.hpp:289:75: error: ‘type’ in namespace ‘::’ does not name a type
std::is_same<Scalar, ReturnScalar>::value>::type>
^
In file included from /usr/local/include/sophus/se3.hpp:7:0,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:
/usr/local/include/sophus/so3.hpp:110:40: error: ‘ScalarBinaryOpTraits’ in namespace ‘Eigen’ does not name a template type
using ReturnScalar = typename Eigen::ScalarBinaryOpTraits<
^
/usr/local/include/sophus/so3.hpp:114:26: error: ‘ReturnScalar’ was not declared in this scope
using SO3Product = SO3<ReturnScalar>;
^
/usr/local/include/sophus/so3.hpp:114:39: error: template argument 1 is invalid
using SO3Product = SO3<ReturnScalar>;
^
/usr/local/include/sophus/so3.hpp:117:32: error: ‘ReturnScalar’ was not declared in this scope
using PointProduct = Vector3<ReturnScalar>;
^
/usr/local/include/sophus/so3.hpp:117:45: error: template argument 1 is invalid
using PointProduct = Vector3<ReturnScalar>;
^
/usr/local/include/sophus/so3.hpp:120:43: error: ‘ReturnScalar’ was not declared in this scope
using HomogeneousPointProduct = Vector4<ReturnScalar>;
^
/usr/local/include/sophus/so3.hpp:120:56: error: template argument 1 is invalid
using HomogeneousPointProduct = Vector4<ReturnScalar>;
^
/usr/local/include/sophus/so3.hpp:329:15: error: ‘SO3Product’ does not name a type
SOPHUS_FUNC SO3Product operator*(
^
/usr/local/include/sophus/so3.hpp:362:15: error: ‘PointProduct’ does not name a type
SOPHUS_FUNC PointProduct operator*(
^
/usr/local/include/sophus/so3.hpp:377:15: error: ‘HomogeneousPointProduct’ does not name a type
SOPHUS_FUNC HomogeneousPointProduct operator*(
^
/usr/local/include/sophus/so3.hpp:399:38: error: ‘ReturnScalar’ was not declared in this scope
std::is_same<Scalar, ReturnScalar>::value>::type>
^
/usr/local/include/sophus/so3.hpp:399:51: error: template argument 2 is invalid
std::is_same<Scalar, ReturnScalar>::value>::type>
^
/usr/local/include/sophus/so3.hpp:399:63: error: template argument 1 is invalid
std::is_same<Scalar, ReturnScalar>::value>::type>
^
/usr/local/include/sophus/so3.hpp:399:75: error: ‘type’ in namespace ‘::’ does not name a type
std::is_same<Scalar, ReturnScalar>::value>::type>
^
In file included from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:0:
/usr/local/include/sophus/se3.hpp:85:40: error: ‘ScalarBinaryOpTraits’ in namespace ‘Eigen’ does not name a template type
using ReturnScalar = typename Eigen::ScalarBinaryOpTraits<
^
/usr/local/include/sophus/se3.hpp:89:26: error: ‘ReturnScalar’ was not declared in this scope
using SE3Product = SE3<ReturnScalar>;
^
/usr/local/include/sophus/se3.hpp:89:39: error: template argument 1 is invalid
using SE3Product = SE3<ReturnScalar>;
^
/usr/local/include/sophus/se3.hpp:92:32: error: ‘ReturnScalar’ was not declared in this scope
using PointProduct = Vector3<ReturnScalar>;
^
/usr/local/include/sophus/se3.hpp:92:45: error: template argument 1 is invalid
using PointProduct = Vector3<ReturnScalar>;
^
/usr/local/include/sophus/se3.hpp:95:43: error: ‘ReturnScalar’ was not declared in this scope
using HomogeneousPointProduct = Vector4<ReturnScalar>;
^
/usr/local/include/sophus/se3.hpp:95:56: error: template argument 1 is invalid
using HomogeneousPointProduct = Vector4<ReturnScalar>;
^
/usr/local/include/sophus/se3.hpp:308:15: error: ‘SE3Product’ does not name a type
SOPHUS_FUNC SE3Product operator*(
^
/usr/local/include/sophus/se3.hpp:325:15: error: ‘PointProduct’ does not name a type
SOPHUS_FUNC PointProduct operator*(
^
/usr/local/include/sophus/se3.hpp:335:15: error: ‘HomogeneousPointProduct’ does not name a type
SOPHUS_FUNC HomogeneousPointProduct operator*(
^
/usr/local/include/sophus/se3.hpp:359:38: error: ‘ReturnScalar’ was not declared in this scope
std::is_same<Scalar, ReturnScalar>::value>::type>
^
/usr/local/include/sophus/se3.hpp:359:51: error: template argument 2 is invalid
std::is_same<Scalar, ReturnScalar>::value>::type>
^
/usr/local/include/sophus/se3.hpp:359:63: error: template argument 1 is invalid
std::is_same<Scalar, ReturnScalar>::value>::type>
^
/usr/local/include/sophus/se3.hpp:359:75: error: ‘type’ in namespace ‘::’ does not name a type
std::is_same<Scalar, ReturnScalar>::value>::type>
^
/home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp: In function ‘int main(int, char**)’:
/home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:48: error: no match for ‘operator*’ (operand types are ‘Sophus::SE3d {aka Sophus::SE3}’ and ‘Eigen::Vector3d {aka Eigen::Matrix<double, 3, 1>}’)
Eigen::Vector3d pointWorld = T * point;
^
In file included from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:0:
/usr/local/include/sophus/se3.hpp:350:20: note: candidate: Sophus::SE3Base::Line Sophus::SE3Base::operator*(const Line&) const [with Derived = Sophus::SE3; Sophus::SE3Base::Line = Eigen::ParametrizedLine<double, 3, 0>; typename Eigen::internal::traits::Scalar = double]
SOPHUS_FUNC Line operator*(Line const& l) const {
^
/usr/local/include/sophus/se3.hpp:350:20: note: no known conversion for argument 1 from ‘Eigen::Vector3d {aka Eigen::Matrix<double, 3, 1>}’ to ‘const Line& {aka const Eigen::ParametrizedLine<double, 3, 0>&}’
In file included from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core/cvstd.inl.hpp:47:0,
from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core.hpp:3281,
from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/opencv.hpp:52,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:3:
/usr/include/c++/5/complex:386:5: note: candidate: template std::complex<_Tp> std::operator*(const std::complex<_Tp>&, const std::complex<_Tp>&)
operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
^
/usr/include/c++/5/complex:386:5: note: template argument deduction/substitution failed:
/home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const std::complex<_Tp>’
Eigen::Vector3d pointWorld = T * point;
^
In file included from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core/cvstd.inl.hpp:47:0,
from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core.hpp:3281,
from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/opencv.hpp:52,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:3:
/usr/include/c++/5/complex:395:5: note: candidate: template std::complex<_Tp> std::operator*(const std::complex<_Tp>&, const _Tp&)
operator*(const complex<_Tp>& __x, const _Tp& __y)
^
/usr/include/c++/5/complex:395:5: note: template argument deduction/substitution failed:
/home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const std::complex<_Tp>’
Eigen::Vector3d pointWorld = T * point;
^
In file included from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core/cvstd.inl.hpp:47:0,
from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/core.hpp:3281,
from /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/opencv.hpp:52,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:3:
/usr/include/c++/5/complex:404:5: note: candidate: template std::complex<_Tp> std::operator*(const _Tp&, const std::complex<_Tp>&)
operator*(const _Tp& __x, const complex<_Tp>& __y)
^
/usr/include/c++/5/complex:404:5: note: template argument deduction/substitution failed:
/home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Eigen::Vector3d {aka Eigen::Matrix<double, 3, 1>}’ is not derived from ‘const std::complex<_Tp>’
Eigen::Vector3d pointWorld = T * point;
^
In file included from /usr/include/eigen3/Eigen/Householder:24:0,
from /usr/include/eigen3/Eigen/QR:17,
from /usr/include/eigen3/Eigen/Dense:4,
from /usr/local/include/sophus/rotation_matrix.hpp:7,
from /usr/local/include/sophus/so3.hpp:7,
from /usr/local/include/sophus/se3.hpp:7,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:
/usr/include/eigen3/Eigen/src/Householder/HouseholderSequence.h:439:99: note: candidate: template<class OtherDerived, class VectorsType, class CoeffsType, int Side> typename Eigen::internal::matrix_type_times_scalar_type<typename VectorsType::Scalar, OtherDerived>::Type Eigen::operator*(const Eigen::MatrixBase&, const Eigen::HouseholderSequence<VectorsType, CoeffsType, Side>&)
_times_scalar_type<typename VectorsType::Scalar,OtherDerived>::Type operator*(c
^
/usr/include/eigen3/Eigen/src/Householder/HouseholderSequence.h:439:99: note: template argument deduction/substitution failed:
/home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const Eigen::MatrixBase’
Eigen::Vector3d pointWorld = T * point;
^
In file included from /usr/include/eigen3/Eigen/Core:397:0,
from /usr/include/eigen3/Eigen/Dense:1,
from /usr/local/include/sophus/rotation_matrix.hpp:7,
from /usr/local/include/sophus/so3.hpp:7,
from /usr/local/include/sophus/se3.hpp:7,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:
/usr/include/eigen3/Eigen/src/Core/Transpositions.h:350:1: note: candidate: template<class TranspositionsDerived, class MatrixDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::TranspositionsBase&, const Eigen::MatrixBase&)
operator*(const TranspositionsBase &transpositions,
^
/usr/include/eigen3/Eigen/src/Core/Transpositions.h:350:1: note: template argument deduction/substitution failed:
/home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const Eigen::TranspositionsBase’
Eigen::Vector3d pointWorld = T * point;
^
In file included from /usr/include/eigen3/Eigen/Core:397:0,
from /usr/include/eigen3/Eigen/Dense:1,
from /usr/local/include/sophus/rotation_matrix.hpp:7,
from /usr/local/include/sophus/so3.hpp:7,
from /usr/local/include/sophus/se3.hpp:7,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:
/usr/include/eigen3/Eigen/src/Core/Transpositions.h:338:1: note: candidate: template<class MatrixDerived, class TranspositionsDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::MatrixBase&, const Eigen::TranspositionsBase&)
operator*(const MatrixBase &matrix,
^
/usr/include/eigen3/Eigen/src/Core/Transpositions.h:338:1: note: template argument deduction/substitution failed:
/home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const Eigen::MatrixBase’
Eigen::Vector3d pointWorld = T * point;
^
In file included from /usr/include/eigen3/Eigen/Core:396:0,
from /usr/include/eigen3/Eigen/Dense:1,
from /usr/local/include/sophus/rotation_matrix.hpp:7,
from /usr/local/include/sophus/so3.hpp:7,
from /usr/local/include/sophus/se3.hpp:7,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:
/usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:558:1: note: candidate: template<class PermutationDerived, class MatrixDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::PermutationBase&, const Eigen::MatrixBase&)
operator*(const PermutationBase &permutation,
^
/usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:558:1: note: template argument deduction/substitution failed:
/home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const Eigen::PermutationBase’
Eigen::Vector3d pointWorld = T * point;
^
In file included from /usr/include/eigen3/Eigen/Core:396:0,
from /usr/include/eigen3/Eigen/Dense:1,
from /usr/local/include/sophus/rotation_matrix.hpp:7,
from /usr/local/include/sophus/so3.hpp:7,
from /usr/local/include/sophus/se3.hpp:7,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:
/usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:546:1: note: candidate: template<class MatrixDerived, class PermutationDerived> const Eigen::Product<MatrixDerived, PermutationDerived, 2> Eigen::operator*(const Eigen::MatrixBase&, const Eigen::PermutationBase&)
operator*(const MatrixBase &matrix,
^
/usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:546:1: note: template argument deduction/substitution failed:
/home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:62:50: note: ‘Sophus::SE3d {aka Sophus::SE3}’ is not derived from ‘const Eigen::MatrixBase’
Eigen::Vector3d pointWorld = T * point;
^
In file included from /usr/include/eigen3/Eigen/src/Core/MatrixBase.h:126:0,
from /usr/include/eigen3/Eigen/Core:345,
from /usr/include/eigen3/Eigen/Dense:1,
from /usr/local/include/sophus/rotation_matrix.hpp:7,
from /usr/local/include/sophus/so3.hpp:7,
from /usr/local/include/sophus/se3.hpp:7,
from /home/lzw/learn_slam/bookcode2/ch5/rgbd/joinMap.cpp:5:
/usr/include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h:88:1: note: candidate: const Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple2_op<double, std::complex >, const Eigen::Matrix<double, 3, 1> > Eigen::operator*(const std::complex&, const StorageBaseType&)
operator*(const std::complex& scalar, const StorageBaseType& matrix)
^
/usr/include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h:88:1: note: no known conversion for argument 1 from ‘Sophus::SE3d {aka Sophus::SE3}’ to ‘const std::complex&’
/usr/include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h:83:1: note: candidate: const ScalarMultipleReturnType Eigen::operator*(const Scalar&, const StorageBaseType&)
operator*(const Scalar& scalar, const StorageBaseType& matrix)
^
/usr/include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h:83:1: note: no known conversion for argument 1 from ‘Sophus::SE3d {aka Sophus::SE3}’ to ‘const Scalar& {aka const double&}’
rgbd/CMakeFiles/joinMap.dir/build.make:62: recipe for target 'rgbd/CMakeFiles/joinMap.dir/joinMap.cpp.o' failed
make[2]: *** [rgbd/CMakeFiles/joinMap.dir/joinMap.cpp.o] Error 1
CMakeFiles/Makefile2:234: recipe for target 'rgbd/CMakeFiles/joinMap.dir/all' failed
make[1]: *** [rgbd/CMakeFiles/joinMap.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

公式6.41

请问公式6.41中的$\sigma$这一项是为什么?

ch4中的程序执行问题

在ch4中最后执行轨迹误差时遇到如下问题:
trajectory ./example/groundtruth.txt not found.
trajectory ./example/estimated.txt not found.
trajectoryError: /home/zx/SLAM14CODE/slambook2-master/ch4/example/trajectoryError.cpp:22: int main(int, char**): Assertion `!groundtruth.empty() && !estimated.empty()' failed.
已放弃 (核心已转储)
望作者有空解答一下,万分感谢!

ch7 pose_estimation_3d2d

calling bundle adjustment by g2o
pose_estimation_3d2d: /usr/include/eigen3/Eigen/src/Core/MapBase.h:195: void Eigen::MapBase<Derived, 0>::checkSanity(typename Eigen::internal::enable_if<(Eigen::internal::traits::Alignment > 0), void*>::type) const [with T = Eigen::Map<Eigen::Matrix<double, 2, 6>, 32, Eigen::Stride<0, 0> >; Derived = Eigen::Map<Eigen::Matrix<double, 2, 6>, 32, Eigen::Stride<0, 0> >; typename Eigen::internal::enable_if<(Eigen::internal::traits::Alignment > 0), void*>::type = void*]: Assertion `( ((internal::UIntPtr(m_data) % internal::traits::Alignment) == 0) || (cols() * rows() * minInnerStride * sizeof(Scalar)) < internal::traits::Alignment ) && "data is not aligned"' failed.
Signal: SIGABRT (Aborted)

bundleAdjustmentG2O(pts_3d_eigen, pts_2d_eigen, K, pose_g2o);运行这句话老是触发eigen的警告
eigen_assert(( ((internal::UIntPtr(m_data) % internal::traits::Alignment) == 0)
|| (cols() * rows() * minInnerStride * sizeof(Scalar)) < internal::traits::Alignment ) && "data is not aligned");

一会能运行一会不能运行,这是什么错误,高博?

ch8 opencv 3.2.0 parallel_for_ doesn't support std::bind function

compiling error looks like this:

/home/ran/Documents/Playground/slambook2/ch8/direct_method.cpp: In function ‘void DirectPoseEstimationSingleLayer(const cv::Mat&, const cv::Mat&, const VecVector2d&, std::vector<double, std::allocator<double> >, Sophus::SE3d&)’:
/home/ran/Documents/Playground/slambook2/ch8/direct_method.cpp:172:36: error: invalid initialization of reference of type ‘const cv::ParallelLoopBody&’ from expression of type ‘std::_Bind_helper<false, void (JacobianAccumulator::*)(const cv::Range&), JacobianAccumulator*, const std::_Placeholder<1>&>::type {aka std::_Bind<void (JacobianAccumulator::*(JacobianAccumulator*, std::_Placeholder<1>))(const cv::Range&)>}’
                           std::bind(&JacobianAccumulator::accumulate_jacobian, &jaco_accu, std::placeholders::_1));
                           ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/opencv2/core.hpp:3216:0,
                 from /usr/include/opencv2/opencv.hpp:52,
                 from /home/ran/Documents/Playground/slambook2/ch8/direct_method.cpp:1:
/usr/include/opencv2/core/utility.hpp:478:17: note: in passing argument 2 of ‘void cv::parallel_for_(const cv::Range&, const cv::ParallelLoopBody&, double)’
 CV_EXPORTS void parallel_for_(const Range& range, const ParallelLoopBody& body, double nstripes=-1.);

go to opencv utility.hpp and found that the definition of parallel_for_ is like this:

CV_EXPORTS void parallel_for_(const Range& range, const ParallelLoopBody& body, double nstripes=-1.);

so, we have to modify the class JacobianAccumulator, extend it from cv::ParallelLoopBody and change accumulate_jacobian function to it's operator override: virtual void operator()(const cv::Range& range) const

I have updated the source in my folk, you can download from here

CH6中的CMakeLists.txt文件中引用g2o的参数名有误

在MAC下编译,使用的FindG2O.cmake文件查找。但是CMakeLists.txt中这一句有问题,找不到值!include_directories(${G2O_INCLUDE_DIRS})
查看FindG2O.cmake发现应该改为:include_directories(${G2O_INCLUDE_DIR})

同时把target_link_libraries中的g2o_core和g2o_stuff修改为${G2O_CORE_LIBRARY} 和${G2O_STUFF_LIBRARY}

float dd = d / 5000;

float dd = d / 5000;
Point2d p1 = pixel2cam(Point2f(image_points.at(i, 0), image_points.at(i, 1)), K);
why use dd = d / 5000? how to get this parameter?

ch5 运行imagebasics和undistortImage都出现了问题,是opencv的问题么?如何解决呢?

Scanning dependencies of target imageBasics
Scanning dependencies of target undistortImage
[ 50%] Building CXX object CMakeFiles/undistortImage.dir/undistortImage.cpp.o
[ 50%] Building CXX object CMakeFiles/imageBasics.dir/imageBasics.cpp.o
[ 75%] Linking CXX executable imageBasics
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘main’中:
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:13:对‘cv::imread(cv::String const&, int)’未定义的引用
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:23:对‘cv::imshow(cv::String const&, cv::_InputArray const&)’未定义的引用
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:24:对‘cv::waitKey(int)’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘main’中:
/usr/local/include/opencv2/core/mat.hpp:1267:对‘cv::noArray()’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘main’中:
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:56:对‘cv::Mat::setTo(cv::_InputArray const&, cv::_InputArray const&)’未定义的引用
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:57:对‘cv::imshow(cv::String const&, cv::_InputArray const&)’未定义的引用
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:58:对‘cv::waitKey(int)’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘main’中:
/usr/local/include/opencv2/core/mat.hpp:1267:对‘cv::noArray()’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘main’中:
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:62:对‘cv::Mat::setTo(cv::_InputArray const&, cv::_InputArray const&)’未定义的引用
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:63:对‘cv::imshow(cv::String const&, cv::_InputArray const&)’未定义的引用
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:64:对‘cv::imshow(cv::String const&, cv::InputArray const&)’未定义的引用
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:65:对‘cv::waitKey(int)’未定义的引用
/home/wei/下载/slambook2-master/ch5/imageBasics/imageBasics.cpp:68:对‘cv::destroyAllWindows()’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘cv::String::String(char const*)’中:
/usr/local/include/opencv2/core/cvstd.hpp:602:对‘cv::String::allocate(unsigned long)’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘cv::String::~String()’中:
/usr/local/include/opencv2/core/cvstd.hpp:648:对‘cv::String::deallocate()’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘cv::Mat::Mat(cv::Mat const&)’中:
/usr/local/include/opencv2/core/mat.inl.hpp:569:对‘cv::Mat::copySize(cv::Mat const&)’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘cv::Mat::~Mat()’中:
/usr/local/include/opencv2/core/mat.inl.hpp:774:对‘cv::fastFree(void*)’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘cv::Mat::clone() const’中:
/usr/local/include/opencv2/core/mat.inl.hpp:846:对‘cv::Mat::copyTo(cv::OutputArray const&) const’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘cv::Mat::release()’中:
/usr/local/include/opencv2/core/mat.inl.hpp:886:对‘cv::Mat::deallocate()’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘cv::Mat::operator()(cv::Rect
const&) const’中:
/usr/local/include/opencv2/core/mat.inl.hpp:912:对‘cv::Mat::Mat(cv::Mat const&, cv::Rect
const&)’未定义的引用
CMakeFiles/imageBasics.dir/imageBasics.cpp.o:在函数‘cv::Mat::operator=(cv::Mat&&)’中:
/usr/local/include/opencv2/core/mat.inl.hpp:1455:对‘cv::fastFree(void*)’未定义的引用
collect2: error: ld returned 1 exit status
CMakeFiles/imageBasics.dir/build.make:83: recipe for target 'imageBasics' failed
make[2]: *** [imageBasics] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/imageBasics.dir/all' failed

ch03和ch04中程序编译问题

第三讲中关于显示运动轨迹问题,在程序编译完成无异常之后,终端输入./plotTrajectory
出现如下错误
cannot find trajectory file at ./examples/trajectory.txt
第四讲中关于轨迹误差的编译
cmake ..
make
/home/wangchen/slambook/ch4/example/trajectoryError.cpp:5:10: fatal error: sophus/se3.hpp: 没有那个文件或目录
#include <sophus/se3.hpp>
^~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/trajectoryError.dir/build.make:62: recipe for target 'CMakeFiles/trajectoryError.dir/trajectoryError.o' failed
make[2]: *** [CMakeFiles/trajectoryError.dir/trajectoryError.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/trajectoryError.dir/all' failed
make[1]: *** [CMakeFiles/trajectoryError.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
望老师空余时间可解答

关于编译ch03中plotTrajectory.cpp的错误

当我编译时发生如下错误

/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:13:28: error: ‘Isometry3d’ was not declared in this scope
void DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator>);
^~~~~~~~~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:13:65: error: ‘Isometry3d’ was not declared in this scope
void DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator>);
^~~~~~~~~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:13:65: error: template argument 1 is invalid
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:13:75: error: template argument 1 is invalid
void DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator>);
^~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:13:75: error: template argument 2 is invalid
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp: In function ‘int main(int, char**)’:
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:17:10: error: ‘Isometry3d’ was not declared in this scope
vector<Isometry3d, Eigen::aligned_allocator> poses;
^~~~~~~~~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:17:47: error: type/value mismatch at argument 1 in template parameter list for ‘template class Eigen::aligned_allocator’
vector<Isometry3d, Eigen::aligned_allocator> poses;
^~~~~~~~~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:17:47: note: expected a type, got ‘Isometry3d’
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:17:57: error: template argument 1 is invalid
vector<Isometry3d, Eigen::aligned_allocator> poses;
^~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:17:57: error: template argument 2 is invalid
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:27:16: error: expected ‘;’ before ‘Twr’
Isometry3d Twr(Quaterniond(qw, qx, qy, qz));
^~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:28:5: error: ‘Twr’ was not declared in this scope
Twr.pretranslate(Vector3d(tx, ty, tz));
^~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:29:11: error: request for member ‘push_back’ in ‘poses’, which is of non-class type ‘int’
poses.push_back(Twr);
^~~~~~~~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:31:34: error: request for member ‘size’ in ‘poses’, which is of non-class type ‘int’
cout << "read total " << poses.size() << " pose entries" << endl;
^~~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp: At global scope:
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:39:28: error: ‘Isometry3d’ was not declared in this scope
void DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator> poses) {
^~~~~~~~~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:39:65: error: ‘Isometry3d’ was not declared in this scope
void DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator> poses) {
^~~~~~~~~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:39:65: error: template argument 1 is invalid
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:39:75: error: template argument 1 is invalid
void DrawTrajectory(vector<Isometry3d, Eigen::aligned_allocator> poses) {
^~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:39:75: error: template argument 2 is invalid
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp: In function ‘void DrawTrajectory(int)’:
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:60:34: error: request for member ‘size’ in ‘poses’, which is of non-class type ‘int’
for (size_t i = 0; i < poses.size(); i++) {
^~~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:62:28: error: invalid types ‘int[size_t {aka long unsigned int}]’ for array subscript
Vector3d Ow = poses[i].translation();
^
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:63:28: error: invalid types ‘int[size_t {aka long unsigned int}]’ for array subscript
Vector3d Xw = poses[i] * (0.1 * Vector3d(1, 0, 0));
^
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:64:28: error: invalid types ‘int[size_t {aka long unsigned int}]’ for array subscript
Vector3d Yw = poses[i] * (0.1 * Vector3d(0, 1, 0));
^
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:65:28: error: invalid types ‘int[size_t {aka long unsigned int}]’ for array subscript
Vector3d Zw = poses[i] * (0.1 * Vector3d(0, 0, 1));
^
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:79:34: error: request for member ‘size’ in ‘poses’, which is of non-class type ‘int’
for (size_t i = 0; i < poses.size(); i++) {
^~~~
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:82:24: error: invalid types ‘int[size_t {aka long unsigned int}]’ for array subscript
auto p1 = poses[i], p2 = poses[i + 1];
^
/home/deeptuuk/code/slambook2/ch3/examples/plotTrajectory.cpp:84:18: error: ‘p2’ was not declared in this scope
glVertex3d(p2.translation()[0], p2.translation()[1], p2.translation()[2]);
^~
examples/CMakeFiles/plotTrajectory.dir/build.make:62: recipe for target 'examples/CMakeFiles/plotTrajectory.dir/plotTrajectory.cpp.o' failed
make[2]: *** [examples/CMakeFiles/plotTrajectory.dir/plotTrajectory.cpp.o] Error 1
CMakeFiles/Makefile2:289: recipe for target 'examples/CMakeFiles/plotTrajectory.dir/all' failed
make[1]: *** [examples/CMakeFiles/plotTrajectory.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

提取ORB特征点时是不是应该按照灰度图读取图片?

第七章的代码读取图片时都是按彩色图读取的,但是FAST关键点不应该是基于灰度的算法吗?这里不明白为什么不是按照灰度图读取。在pose_estimation_2d2d.cpp的程序里如果按照灰度图读取图片,那么得到的R,t参数与按照彩色读取是不一样的:

  • 原来的读取参数为 CV_LOAD_IMAGE_COLOR
 Mat img_1 = imread(argv[1], CV_LOAD_IMAGE_COLOR);
 Mat img_2 = imread(argv[2], CV_LOAD_IMAGE_COLOR);
R is 
[0.9985534106102478, -0.05339308467584758, 0.006345444621108698;
 0.05321959721496264, 0.9982715997131746, 0.02492965459802003;
 -0.007665548311697523, -0.02455588961730239, 0.9996690690694516]
t is 
[-0.8829934995085544;
 -0.05539655431450562;
 0.4661048182498402]
  • 修改为cv::IMREAD_GRAYSCALE
 Mat img_1 = imread(argv[1], cv::IMREAD_GRAYSCALE);
 Mat img_2 = imread(argv[2], cv::IMREAD_GRAYSCALE);
R is 
[0.9956586755557854, -0.06056285980694839, 0.07068197650393594;
 0.05735576134499068, 0.9972677254086454, 0.04655534876684903;
 -0.07330837899609778, -0.04229921831748662, 0.9964118915883602]
t is 
[-0.9753492080965818;
 -0.2054788588410324;
 0.08045098405089755]

pose_estimation_3d2d.cpp雅克比矩阵公式输入错误

代码中雅克比矩阵:

201       J << -fx * inv_z,
202         0,
203         fx * pc[0] * inv_z2,
204         fx * pc[0] * pc[1] * inv_z2,
205         -fx - fx * pc[0] * pc[0] * inv_z2,
206         fx * pc[1] * inv_z,
207         0,
208         -fy * inv_z,
209         fy * pc[1] * inv_z, // 这里应该是inv_z2
210         fy + fy * pc[1] * pc[1] * inv_z2,
211         -fy * pc[0] * pc[1] * inv_z2,
212         -fy * pc[0] * inv_z;
213 
214       H += J.transpose() * J;
215       b += -J.transpose() * e;
216     }

第209行,根据书中的公式,此处应该是除以Z的平方,根据代码,也就是乘以inv_z2,估计漏了个2:

fy*pc[1]*inv_z2,

The dataset normalization function in ch9

您好,
请问能解释下第9章的代码中,common.cpprotation.h下面的几个函数么,即它们都做了什么事,以及关键变量的含义?

  1. AngleAxisRotationPoint。
  2. Camera 和 Angle-Axis & Center的相互转换中,Center指的是什么?

ch13

您好,不知道您是否讲位姿输出到文件,我已仔细查看了轨迹输出应该是没问题的。我用同一个数据集(odo的03)跑了您的ch13和ORBSLAM2,对比ORBSLAM2的轨迹,这ch13输出的轨迹很乱,比如ch13估计平移的x值,ORBSLAM2一直是增加的,可ch13估计平移的x值却增增减减,呈波浪状。期待您的回复,谢谢

Could NOT find CSPARSE (missing: CSPARSE_LIBRARY)

-- Could NOT find CSPARSE (missing:  CSPARSE_LIBRARY) 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CSPARSE_LIBRARY
    linked by target "myslam" in directory /media/zhangxin/Data/github/slambook2/ch13/src
    linked by target "test_triangulation" in directory /media/zhangxin/Data/github/slambook2/ch13/test
    linked by target "run_kitti_stereo" in directory /media/zhangxin/Data/github/slambook2/ch13/app

-- Configuring incomplete, errors occurred!
See also "/media/zhangxin/Data/github/slambook2/ch13/build/CMakeFiles/CMakeOutput.log".
See also "/media/zhangxin/Data/github/slambook2/ch13/build/CMakeFiles/CMakeError.log".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.