APAP多图拼接代码

整理一下APAP image stitching的代码:

项目地址:https://cs.adelaide.edu.au/~tjchin/apap/
其中MDLT是两张图片的拼接,调试过程基本很简单,不再赘述;
对于BAMDLT多图拼接代码,现将出现的问题及解决办法整理如下:

  1. BAMDLT使用依赖三个库,分别是EIGEN, Google’s Ceres solver,GLOG
  • 其中EIGEN库的安装按照官方教程 http://eigen.tuxfamily.org/index.php?title=Main_Page
    即可,也不存在由于版本导致的问题;
  • GLOG如果安装的是最新版本,会发现根本没有libglog.so库(该库在matlab函数用mex编译时需要),只有libglog.a库,因此它需要安装old version,old version链接为 https://github.com/google/glog/releases
    0.3.4以前的版本应该都可以,我安装的是glog:0.3.4,安装代码为:
    tar zxvf glog-0.3.4.tar.gz
    cd glog-0.3.4
    ./configure
    make
    sudo make install
    
    安装完成后可以在目录/usr/local/lib下看到liblog.so动态库
  • 同样的,Google’s Ceres solver也不能安装最新版本,否则就找不到libcere_shared.so动态库,也需要安装old version,链接为 https://ceres-solver.googlesource.com/ceres-solver/+refs
    APAP中使用的是1.6.0版本,但在我电脑上该版本无法编译,因此我安装了1.3.0版本,然后重新编译生成了mex文件
    安装过程中首先需要安装依赖项,其次安装Ceres;
    # CMake
    sudo apt-get install cmake
    # google-glog + gflags
    sudo apt-get install libgoogle-glog-dev
    # BLAS & LAPACK
    sudo apt-get install libatlas-base-dev
    # Eigen3
    sudo apt-get install libeigen3-dev
    # SuiteSparse and CXSparse (optional)
    # - If you want to build Ceres as a *static* library (the default)
    #   you can use the SuiteSparse package in the main Ubuntu package
    #   repository:
    sudo apt-get install libsuitesparse-dev
    # - However, if you want to build Ceres as a *shared* library, you must
    #   add the following PPA:
    sudo add-apt-repository ppa:bzindovic/suitesparse-bugfix-1319687
    sudo apt-get update
    sudo apt-get install libsuitesparse-dev
    # 依赖项安装完成,安装Ceres
    tar zxf ceres-solver-1.3.0.tar.gz
    mkdir ceres-bin
    cd ceres-bin
    cmake ../ceres-solver-1.3.0
    make -j3
    make test
    # Optionally install Ceres, it can also be exported using CMake which
    # allows Ceres to be used without requiring installation, see the documentation
    # for the EXPORT_BUILD_DIR option for more information.
    make install
    
    安装完成后可以在/usr/local/lib下发现libceres_shared.so文件等
  1. 代码依赖项安装完毕,接下来是代码,由于我使用的是matlab2015b,对于该版本及以上its pooling function改变了,因此需要将
    将该部分:
    poolsize = matlabpool('size');
    if poolsize == 0 %if not, we attemp to do it:
        matlabpool open;
    end
    修改为:
    if isempty(gcp('nocreate'))
       parpool;
    end
    
  2. 前面我说过,我安装Google Ceres Solver版本是1.3.0, 因此需要重新生成ceresRigidError.mexa64和ceresNonrigidError.mexa64文件,运行MDLT_mainImageStitchingNRBA.m,这个时候注意如果出现了这样的警告: Warning: You are using gcc version ‘4.8.4’. The version currently supported with MEX is ‘4.7.x’. 不要忽略,不要忽略,不要忽略 (以前养成的陋习,warning都不管)。这是因为高版本ubuntu系统自带的gcc版本过高,这时候需要将系统gcc版本更换为4.7,如果不更换,即使matlab编译成功,也可能会在调用.mexa64文件报错找不到libceres_shared.so.1.3.0更换gcc版本步骤如下:
    #安装gcc
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo  apt-get update
    sudo apt-get  install gcc-4.7
    sudo apt-get  install g++-4.7
    #查看g++安装路径
    which gcc 
    #先切换到g++安装路径下
    cd /usr/bin/ //我电脑中g++安装路径
    #在该路径下将gcc链接到gcc-4.7
    sudo rm g++  //删除原来的符号链接
    sudo ln -s g++-4.7 g++ //重新创建链接
    g++ -v //可见版本已经为4.7了 
    
  3. 重新运行MDLT_mainImageStitchingNRBA.m,如果此时报错…/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21’ not found,可以在bash中运行下面命令,然后重启matlab
    ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/local/MATLAB/R2015b/sys/os/glnxa64/libstdc++.so.6 	
    
  4. 到这基本大功告成,另外可以给一个建议就是运行matlab时候建议在sudo权限下

参考链接:
https://cs.adelaide.edu.au/~tjchin/apap/#Source
http://ceres-solver.org/installation.html
http://eigen.tuxfamily.org/index.php?title=Main_Page
https://blog.csdn.net/u012702874/article/details/50658441
https://blog.csdn.net/Hansry/article/details/80325296
https://www.jianshu.com/p/b7bd7e3044bc

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 19
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 19
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值