libpointmatcher安装和使用

时间:2024-08-19 08:07:25

libpointmatcher介绍:

  libpointmatcher is a modular library implementing the Iterative Closest Point (ICP) algorithm for aligning point clouds. It has applications in robotics and computer vision.

安装:

  1、提前准备

  a. Installing Boost
   安装命令 sudo apt-get install libboost-all-dev

  b. Installing Git
   安装命令 sudo apt-get install git-core

  c. Installing CMake
   sudo apt-get install cmake cmake-gui

  2、正式安装

  a .Installing Eigen
   安装命令 sudo apt-get install libeigen3-dev

b. Installing libnabo
  git clone git://github.com/ethz-asl/libnabo.git
  cd libnabo
  gedit install.sh
  复制如下的命令到文件里面
  

#!/bin/bash
echo start
SRC_DIR=`pwd`
BUILD_DIR=${SRC_DIR}/build
mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ${SRC_DIR}
make
sudo make install
echo done!

  执行./install.sh

  c. Compiling the Documentation
  安装命令 sudo apt-get install doxygen
  安装命令 sudo apt-get install texlive-full

  d. Installing libpointmatcher
  cd ~/Libraries/
  git clone git://github.com/ethz-asl/libpointmatcher.git
  cd libpointmatcher
  gedit install.sh
  复制如下的命令到文件里面

#!/bin/bash
echo start
SRC_DIR=`pwd`
BUILD_DIR=${SRC_DIR}/build
mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo ${SRC_DIR}
make
sudo make install
echo done!

  执行./install.sh
编译用例:
  在libpointmatcher的example目录下
  修改CMakeLists.txt为

cmake_minimum_required(VERSION 3.5)
add_compile_options(-std=c++)
find_package(Boost 1.45. COMPONENTS system filesystem regex) #if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS}) add_executable(pmicp icp.cpp)
target_link_libraries(pmicp pointmatcher ${Boost_LIBRARIES})
install(TARGETS pmicp RUNTIME DESTINATION bin) add_executable(icp_simple icp_simple.cpp)
target_link_libraries(icp_simple pointmatcher ${Boost_LIBRARIES}) add_executable(align_sequence align_sequence.cpp)
target_link_libraries(align_sequence pointmatcher ${Boost_LIBRARIES}) add_executable(list_modules list_modules.cpp)
target_link_libraries(list_modules pointmatcher ${Boost_LIBRARIES}) add_executable(build_map build_map.cpp)
target_link_libraries(build_map pointmatcher ${Boost_LIBRARIES}) add_executable(compute_overlap compute_overlap.cpp)
target_link_libraries(compute_overlap pointmatcher ${Boost_LIBRARIES}) add_executable(icp_advance_api icp_advance_api.cpp)
target_link_libraries(icp_advance_api pointmatcher ${Boost_LIBRARIES}) add_executable(icp_customized icp_customized.cpp)
target_link_libraries(icp_customized pointmatcher ${Boost_LIBRARIES}) #endif()

  进入example的build文件夹下执行make,会在当先目录下生成可执行文件
添加环境变量:
  gedit /etc/profile
  在最后面添加 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
  source /etc/profile
执行用例:
  在build目录下执行  ./icp_simple ../../examples/data/car_cloud400.csv ../../examples/data/car_cloud401.csv

  执行结果:

  Final transformation:
  0.983804 -0.179247 -0.0575061
  0.179247 0.983804 -0.228765
  0 0 1

  无报错成功!