gpt4 book ai didi

c++ - ROS环境搭建错误(catkin)

转载 作者:行者123 更新时间:2023-11-28 04:28:03 26 4
gpt4 key购买 nike

我想在 catkin 工作区中构建我的项目。执行 catkin_make 后我得到了这些错误:

6:11: error: ‘vector’ is not a member of ‘cv’
cv::vector<cv::Point> points;


6:31: error: expected primary-expression before ‘>’ token
cv::vector<cv::Point> points;

9:77: error: no matching function for call to ‘std::vector<Eigen::Matrix<double, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 3, 1> > >::push_back(cv::Point)’


/catkin_ws/src/rgbd_calibration/src/rgbd_calibration/calibration_test.cpp:1123:113: error: no matching function for call to ‘fillConvexPoly(cv::Mat&, std::vector<Eigen::Matrix<double, 3, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 3, 1> > >&, cv::Scalar)’
cv::fillConvexPoly(tmp_image, points, cv::Scalar(c == 0 ? 128 : 0, c == 1 ? 128 : 0, c == 2 ? 128 : 0));
^

在/opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/imgproc/imgproc.hpp:48:0 包含的文件中, 来自/opt/ros/kinetic/include/image_geometry/pinhole_camera_model.h:6,

我已经构建了 opencv 3.3.0,它还找到了`/opt/ros/kinetic/include/opencv-3.3.1-dev/opencv2/imgproc/imgproc.hpp:48:0,

我怀疑某些事情与 opencv 库有关,但找不到。这是我第一次尝试使用 ROS,所以欢迎任何帮助

下面的生成文件:

    cmake_minimum_required(VERSION 2.8.3)
project(rgbd_calibration)
set(CMAKE_BUILD_TYPE RelWithDebInfo)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS cmake_modules roscpp calibration_common geometry_msgs kinect
eigen_conversions camera_info_manager cv_bridge pcl_ros
image_transport)# swissranger_camera)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
find_package(Boost REQUIRED)
find_package(Eigen REQUIRED)
find_package(PCL 1.7 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(OpenMP REQUIRED)
find_package(Ceres REQUIRED)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")


## Uncomment this if the package has a setup.py. This macro ensures
## modules and scripts declared therein get installed
# catkin_python_setup()

#######################################
## Declare ROS messages and services ##
#######################################

## Generate messages in the 'msg' folder
add_message_files(
FILES
Acquisition.msg
)

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

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

###################################################
## Declare things to be passed to other projects ##
###################################################

## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
LIBRARIES interactive_checkerboard_finder rgbd_calibration
CATKIN_DEPENDS roscpp calibration_common geometry_msgs kinect
eigen_conversions camera_info_manager cv_bridge pcl_ros image_transport
DEPENDS eigen3 pcl opencv2
)

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

## Specify additional locations of header files
include_directories(include
${catkin_INCLUDE_DIRS}
${EIGEN_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${CERES_INCLUDE_DIRS}
)

## Declare a cpp library

add_library(rgbd_calibration
src/rgbd_calibration/calibration.cpp include/rgbd_calibration/calibration.h
include/rgbd_calibration/globals.h
src/rgbd_calibration/depth_undistortion_estimation.cpp include/rgbd_calibration/depth_undistortion_estimation.h
src/rgbd_calibration/checkerboard_views.cpp include/rgbd_calibration/checkerboard_views.h
src/rgbd_calibration/checkerboard_views_extractor.cpp include/rgbd_calibration/checkerboard_views_extractor.h
src/rgbd_calibration/publisher.cpp include/rgbd_calibration/publisher.h
)

add_executable(rgbd_offline_calibration
src/rgbd_calibration/calibration_node.cpp include/rgbd_calibration/calibration_node.h
src/rgbd_calibration/offline_calibration_node.cpp include/rgbd_calibration/offline_calibration_node.h
)

#add_executable(simulation
# src/rgbd_calibration/simulation_node.cpp include/rgbd_calibration/simulation_node.h
#)

add_executable(test_calibration
src/rgbd_calibration/test_node.cpp include/rgbd_calibration/test_node.h
src/rgbd_calibration/calibration_test.cpp include/rgbd_calibration/calibration_test.h
)

add_executable(data_collection
src/rgbd_calibration/data_collection_node.cpp
)

## Add dependencies to the executable
# add_dependencies(calibration_node ${PROJECT_NAME})

## Specify libraries to link a library or executable target against

target_link_libraries(rgbd_calibration
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${OpenCV_LIBS}
${CERES_LIBRARIES}
)

target_link_libraries(rgbd_offline_calibration
rgbd_calibration
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${OpenCV_LIBS}
${CERES_LIBRARIES}
)

#target_link_libraries(simulation
# rgbd_calibration
# ${catkin_LIBRARIES}
# ${PCL_LIBRARIES}
# ${OpenCV_LIBS}
# ${CERES_LIBRARIES}
#)

target_link_libraries(test_calibration
rgbd_calibration
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${OpenCV_LIBS}
${CERES_LIBRARIES}
)

target_link_libraries(data_collection
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${OpenCV_LIBS}
)

#############
## Install ##
#############

## Mark executable scripts (Python etc.) for installation
## not required for python when using catkin_python_setup()
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS calibration calibration_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/polynomial_undistortion_matrix_multifit_test.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test
# ${catkin_LIBRARIES}
# ${PCL_LIBRARIES}
# ${OpenCV_LIBS}
# ${CERES_LIBRARIES})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)

最佳答案

您需要使用 STL 的 std::vector<> , CV 没有 vector实现:

#include <vector>

...
std::vector<cv::Point> points;
...

关于c++ - ROS环境搭建错误(catkin),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53760354/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com