视觉SLAM十四讲课后习题—ch13

1.推导式(13.6)

  根据教材后的附录A两个服从高斯分布的随机变量相乘后的结果仍服从高斯分布很容易推导出。

2.把本讲的稠密深度估计改成半稠密,你可以把梯度明显的地方筛选出来。

  (1)dense_mapping.cpp

    对程序进行修改:   

 1 bool update(const Mat& ref, const Mat& curr, const SE3& T_C_R, Mat& depth, Mat& depth_cov )
 2 {
 3 //#pragma omp parallel for
 4     for ( int x=boarder; x<width-boarder; x++ )
 5 //#pragma omp parallel for
 6         for ( int y=boarder; y<height-boarder; y++ )
 7         {
 8             //把遍历所有像素点更改为梯度明显的像素点
 9             Eigen::Vector2d delta(
10                         ref.ptr<uchar>(y)[x+1]-ref.ptr<uchar>(y)[x-1],
11                         ref.ptr<uchar>(y+1)[x]-ref.ptr<uchar>(y-1)[x]
12                     );
13             if(delta.norm()<50)
14                 continue;
15 
16 //            Eigen::Vector2d delta(
17 //                        depth_cov.ptr<uchar>(y)[x+1]-depth_cov.ptr<uchar>(y)[x-1],
18 //                        depth_cov.ptr<uchar>(y+1)[x]-depth_cov.ptr<uchar>(y-1)[x]
19 //                    );
20 //            if(delta.norm()<50)
21 //                continue;
22 //                         遍历每个像素
23             if ( depth_cov.ptr<double>(y)[x] < min_cov || depth_cov.ptr<double>(y)[x] > max_cov ) // 深度已收敛或发散
24                 continue;
25             // 在极线上搜索 (x,y) 的匹配
26             Vector2d pt_curr;
27             bool ret = epipolarSearch (
28                 ref,
29                 curr,
30                 T_C_R,
31                 Vector2d(x,y),
32                 depth.ptr<double>(y)[x],
33                 sqrt(depth_cov.ptr<double>(y)[x]),
34                 pt_curr
35             );
36 
37             if ( ret == false ) // 匹配失败
38                 continue;
39 
40                         // 取消该注释以显示匹配
41             // showEpipolarMatch( ref, curr, Vector2d(x,y), pt_curr );
42 
43             // 匹配成功,更新深度图
44             updateDepthFilter( Vector2d(x,y), pt_curr, T_C_R, depth, depth_cov );
45         }
46 }

   实验结果:以下分别为实验过程中某一时刻的深度图和逐渐趋于稳定的深度图

  

     在运行时间上,半稠密的运行时间比稠密估计少很多。

3.把本讲的单目稠密重建代码从正深度改成逆深度,并添加放射变换。你的实验效果是否有改进?

 

posted @ 2018-12-09 17:00  Iridescent18  阅读(615)  评论(0编辑  收藏  举报