【KITTI数据集】bin转pcd格式

bin_to_pcd

系统环境:Ubuntu16.04
整体结构如下:src放.cpp,bin放velodyne点云,pcd放转换后的文件
【KITTI数据集】bin转pcd格式_第1张图片
好久没写过CMakeLists了,复习一下

cmake_minimum_required(VERSION 2.8.3)
project(bin_to_pcd) 
 
find_package(catkin REQUIRED COMPONENTS
pcl_ros
roscpp
)
 
find_package(PCL 1.7 REQUIRED)
 
catkin_package(
  INCLUDE_DIRS include
  CATKIN_DEPENDS roscpp pcl_ros
)
 
include_directories(
 include
 ${catkin_INCLUDE_DIRS}
)

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
     message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

link_directories(${PCL_LIBRARY_DIRS})
 
add_executable(bin_to_pcd src/bin2pcd.cpp)   
  
target_link_libraries(bin_to_pcd
  ${catkin_LIBRARIES}
  ${PCL_LIBRARIES}
)

终端输入

i=1; for x in /home/xxx/catkin_lidar/src/bin_to_pcd/bin/*.bin; do /home/xxx/catkin_lidar/devel/lib/bin_to_pcd/bin_to_pcd --infile $x --outfile /home/xxx/catkin_lidar/src/bin_to_pcd/pcd/000$i.pcd; let i=i+1; done

中间的路径根据自己的路径更换。
转换完成:
【KITTI数据集】bin转pcd格式_第2张图片

参考

github地址
KITTI数据集说明论文
https://blog.csdn.net/zengzeyu/article/details/79575702

你可能感兴趣的:(C/C++)