标定系列——基于OpenCV4.5.3的lidar与cam外参标定算法(十九)

标定系列——基于OpenCV4.5.3的lidar与cam外参标定算法(十九)

说明

基于OpenCV4.5.3的lidar与cam外参标定算法,注意OpenCV的版本

记录

标定板尺寸

请添加图片描述

CMakeLists.txt

cmake_minimum_required(VERSION 3.0.2)
project(velo2cam_calibration)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -w ")

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  image_geometry
  image_transport
  message_filters
  roscpp
  pcl_ros
  sensor_msgs
  std_msgs
  stereo_msgs
  tf
  tf_conversions
  dynamic_reconfigure
  cmake_modules
)
set(OpenCV_DIR /home/aaa/software/opencv-4.5.3/build)
find_package(TinyXML REQUIRED)
find_package(OpenCV 4.5.3 REQUIRED)

generate_dynamic_reconfigure_options(
  cfg/Lidar.cfg
  cfg/Stereo.cfg
  cfg/Monocular.cfg
  cfg/Plane.cfg
)

################################################
## Declare ROS messages, services and actions ##
################################################
## Generate messages in the 'msg' folder
add_message_files(
  FILES
  ClusterCentroids.msg
)

## Generate added messages and services with any dependencies listed here
generate_messages(
  DEPENDENCIES
  std_msgs
  sensor_msgs
)

###################################
## catkin specific configuration ##
###################################
catkin_package(
  INCLUDE_DIRS include
  DEPENDS TinyXML
)

###########
## Build ##
###########
include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_LIBRARIES}
  ${TinyXML_INCLUDE_DIRS}
)

#link_directories()

#add_definitions()

## Declare cpp executables
add_executable(lidar_pattern src/lidar_pattern.cpp)
add_executable(stereo_pattern src/stereo_pattern.cpp)
add_executable(mono_qr_pattern src/mono_qr_pattern.cpp)
add_executable(velo2cam_calibration src/velo2cam_calibration.cpp)
add_executable(v2c_plane_segmentation src/plane.cpp)
add_executable(v2c_disp_masker src/disp_masker.cpp)

## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
add_dependencies(lidar_pattern
  ${catkin_EXPORTED_TARGETS}
  velo2cam_calibration_generate_messages_cpp
  ${PROJECT_NAME}_gencfg
)
add_dependencies(stereo_pattern
  ${catkin_EXPORTED_TARGETS}
  velo2cam_calibration_generate_messages_cpp
  ${PROJECT_NAME}_gencfg
)
add_dependencies(mono_qr_pattern
  ${catkin_EXPORTED_TARGETS}
  velo2cam_calibration_generate_messages_cpp
  ${PROJECT_NAME}_gencfg
)
add_dependencies(
  velo2cam_calibration
  ${catkin_EXPORTED_TARGETS}
  velo2cam_calibration_generate_messages_cpp
  ${PROJECT_NAME}_gencfg
)
add_dependencies(v2c_plane_segmentation ${PROJECT_NAME}_gencfg)

## Specify libraries to link a library or executable target against
target_link_libraries(stereo_pattern
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)
target_link_libraries(lidar_pattern
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)
target_link_libraries(mono_qr_pattern
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)
target_link_libraries(velo2cam_calibration
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
  ${TinyXML_LIBRARIES}
)
target_link_libraries(v2c_plane_segmentation
  ${catkin_LIBRARIES}
)
target_link_libraries(v2c_disp_masker
  ${catkin_LIBRARIES}
  ${OpenCV_LIBRARIES}
)

遇到的问题

1.在执行catkin_make后出现OpenCV的报错,错误内容类似如下:

error: ‘struct cv::aruco::DetectorParameters’ has no member named ‘cornerRefinementMethod’; did you mean ‘cornerRefinementWinSize’?
          detectorParams->cornerRefinementMethod = aruco::CORNER_REFINE_SUBPIX;
                          ^~~~~~~~~~~~~~~~~~~~~~
                          cornerRefinementWinSize

2.解决方法
对OpenCV进行源码编译,这里编译了opencv-4.5.3.zip和opencv_contrib-4.5.3.zip两个源码,并修改相应的CMakeLists.txt文件,问题解决。

编译opencv-4.5.3.zip和opencv_contrib-4.5.3.zip方法见链接

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值