gpt4 book ai didi

opencv - 如何使用 CMake (ubuntu 14.04) 将 opencv 链接到 ROS indigo (catkin)

转载 作者:太空宇宙 更新时间:2023-11-03 21:44:28 27 4
gpt4 key购买 nike

我目前无法使用 cv_bridge。我收到这个编译错误

CMake Error at /opt/ros/indigo/share/cv_bridge/cmake/cv_bridgeConfig.cmake:106 (message):
Project 'cv_bridge' specifies '/usr/include/opencv' as an include dir,
which is not found. It does neither exist as an absolute directory nor in
'/opt/ros/indigo//usr/include/opencv'. Ask the maintainer ..

可能是我的 CMake 中的问题(...?)

cmake_minimum_required(VERSION 2.8.3)
project(XY)

find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
roscpp
rospy
std_msgs
)

#set(OpenCV_DIR "/usr/local/lib/opencv")
find_package(OpenCV REQUIRED core imgproc highgui PATHS /home/polar/soft/lib/opencv/opencv-3.1.0/cmake)
include_directories( ${OpenCV_INCLUDE_DIRS} )

if(OpenCV_FOUND)
# include_directories(${Boost_INCLUDE_DIRS})
message("\n\n OpenCV found!!!! \n\n")
endif()

关于问题的原因和解决方法的任何想法?我过去一直在使用 ROS fuerte,从来没有遇到过这样的问题....

最佳答案

最后,我修改了文件/opt/ros/indigo/share/cv_bridge/cmake/cv_bridgeConfig.cmake

我变了

set(cv_bridge_FOUND_CATKIN_PROJECT TRUE)

if(NOT "include;/usr/include/opencv;/usr/include " STREQUAL " ")
set(cv_bridge_INCLUDE_DIRS "")
set(_include_dirs "include;/usr/include/opencv;/usr/include")

set(cv_bridge_FOUND_CATKIN_PROJECT TRUE)
if(NOT "include;/usr/local/include/opencv" STREQUAL " ")
set(cv_bridge_INCLUDE_DIRS "")
set(_include_dirs "/usr/local/include/opencv;/usr/include;/usr/local/include")

事实上我只是把usr/include改成了/usr/local/include。这解决了我的问题。但我认为这不是正确的做法 (?)。

关于opencv - 如何使用 CMake (ubuntu 14.04) 将 opencv 链接到 ROS indigo (catkin),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37274190/

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