[代码学习]demo_rgbd在ubuntu16.04上运行的一些修改

这个project的代码详见:我的上一篇博客

由于这个project是2014年的,比较老,直接运行的话需要进行一些修改:

(1)CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
#set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
##此处自行修改安装路径
set(OpenCV_DIR "/home/xxx/Libraries/opencv3.2/release")
set(OpenCV_INCLUDE_DIRS "/home/xxx/Libraries/opencv3.2/release" "/home/xxx/Libraries/opencv3.2/include" "/home/xxx/Libraries/opencv3.2/include/opencv")
include_directories(${OpenCV_INCLUDE_DIRS})
#find_package(OpenCV 2.4 REQUIRED)
find_package(OpenCV 3.2 REQUIRED)


project(demo_rgbd)
set(CMAKE_BUILD_TYPE Release)
set(BUILD_STATIC_LIBS ON)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
  sensor_msgs
  cv_bridge
  pcl_ros
)

find_package(PCL REQUIRED)
find_package(Eigen3 REQUIRED)

###################################
## catkin specific configuration ##
###################################

catkin_package(
  CATKIN_DEPENDS
  roscpp
  std_msgs
  sensor_msgs
  cv_bridge
  pcl_ros
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
  ${PCL_INCLUDE_DIRS}
  ${EIGEN3_INCLUDE_DIR}
  "${PROJECT_SOURCE_DIR}/include"
  /usr/local/include # Location when using 'make system_install'
  /usr/include       # More usual location (e.g. when installing using a package)
)

## Specify additional locations for library files
link_directories(
  /usr/local/lib # Location when using 'make system_install'
  /usr/lib       # More usual location (e.g. when installing using a package)
  #/usr/local/cuda-8.0/lib64/
)
#link_directories("/usr/local/cuda-8.0/lib64/libcudart.so")
add_subdirectory(isamlib)
link_libraries(isamlib)

## Declare executables
add_executable(featureTracking src/featureTracking.cpp)
add_executable(visualOdometry src/visualOdometry.cpp)
add_executable(bundleAdjust src/bundleAdjust.cpp)
add_executable(processDepthmap src/processDepthmap.cpp)
add_executable(stackDepthPoint src/stackDepthPoint.cpp)
add_executable(transformMaintenance src/transformMaintenance.cpp)
add_executable(registerPointCloud src/registerPointCloud.cpp)

## Specify libraries to link a library or executable target against
target_link_libraries(featureTracking ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${PCL_LIBRARIES})
target_link_libraries(visualOdometry ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${PCL_LIBRARIES})
target_link_libraries(bundleAdjust ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${PCL_LIBRARIES})
target_link_libraries(processDepthmap ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${PCL_LIBRARIES})
target_link_libraries(stackDepthPoint ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${PCL_LIBRARIES})
target_link_libraries(transformMaintenance ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${PCL_LIBRARIES})
target_link_libraries(registerPointCloud ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} ${PCL_LIBRARIES})

 

(2)package.xml

<package>
  <name>demo_rgbd</name>
  <version>0.0.1</version>
  <description>Depth Enhanced Monocular Odometry (RGBD camera version)</description>
  <maintainer email="xxx@163.com">nan</maintainer>
  <!-- <url>http://wiki.ros.org/demo_rgbd</url> -->
  <license>LGPL</license>

  <author>xxx</author>

  <buildtool_depend>catkin</buildtool_depend>

  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>sensor_msgs</build_depend>
  <build_depend>cv_bridge</build_depend>
  <build_depend>pcl_ros</build_depend>

  <run_depend>roscpp</run_depend>
  <run_depend>std_msgs</run_depend>
  <run_depend>sensor_msgs</run_depend>
  <run_depend>cv_bridge</run_depend>
  <run_depend>pcl_ros</run_depend>
</package>

(3)个人遇到的一些问题

         no matching function for call to ‘cv::Mat::Mat(IplImage*&)

问题出现在featureTracking.cpp中的

if (showCount == showSkipNum) {
    //Mat imageShowMat(imageShow);
    Mat imageShowMat(cv::cvarrToMat(imageShow));
    bridge.image = imageShowMat;
    bridge.encoding = "mono8";
    sensor_msgs::Image::Ptr imageShowPointer = bridge.toImageMsg();
    imageShowPubPointer->publish(imageShowPointer);
  }

修改为上述代码即可。

至此应该可以顺利编译通过。

之后可以自行修改launch文件中的数据节点,或者修改源文件中的订阅的节点。

但是之后还遇到了些问题,具体的问题是:

问题截图

这个问题在有的自行录制的数据集会出现,有的没有,问题待解决。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值