CMakeLists.txt contains
find_package( OpenCV 4.5.5 REQUIRED
PATHS /usr/local
NO_DEFAULT_PATH)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
geometry_msgs
image_transport
message_filters
nav_msgs
roscpp
std_msgs
tf
)
if(USE_CUDA)
find_package(CUDA)
include_directories("${CUDA_INCLUDE_DIRS}")
add_definitions(-DUSE_CUDA)
endif(USE_CUDA)
include_directories(
# include
${OpenCV_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
add_executable( xxxxx src/xxxxx.cpp )
target_link_libraries( xxxxx ${OpenCV_LIBS} ${catkin_LIBRARIES .........}
Output of catkin_make -DUSE_CUDA=ON
-- Found CUDA: /usr/local/cuda (found suitable exact version "11.6")
-- Found OpenCV: /usr/local (found suitable version "4.5.5", minimum required is "4.5.5")
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Found CUDA: /usr/local/cuda (found version "11.6")
and everything builds and compiles nicely
However, when i run my node, it shows OpenCV(4.2.0) without CUDA:
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.2.0) ../modules/core/include/opencv2/core/private.cuda.hpp:109: error: (-216:No CUDA support) The library is compiled without CUDA support in function 'throw_no_cuda'
I've built OpenCV 4.5.5 with CUDA. Non ROS applications are able to use it correctly
Originally posted by MrOCW on ROS Answers with karma: 58 on 2022-05-02
Post score: 0