question on Converting between ROS images and OpenCV images (C++)
Hi! I copied the code provided in the official page in a immage_converter.cpp file.
I modified the Cmake like this:
cmake_minimum_required(VERSION 2.8.3)
project(prova)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
sensor_msgs
cv_bridge
image_transport
)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES prova
CATKIN_DEPENDS roscpp rospy std_msgs sensor_msgs cv_bridge image_transport
# DEPENDS system_lib
)
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
add_executable(immage_converter src/immage_converter.cpp)
target_link_libraries(immage_converter ${catkin_LIBRARIES})
but I get this error
CMakeFiles/immage_converter.dir/src/immage_converter.cpp.o: nella funzione "ImageConverter::ImageConverter()":
immage_converter.cpp:(.text._ZN14ImageConverterC2Ev[_ZN14ImageConverterC5Ev]+0x4bc): riferimento non definito a "cv::namedWindow(cv::String const[ 89%] Built target wmcs_lib_generate_messages_py
&, int)"
CMakeFiles/immage_converter.dir/src/immage_converter.cpp.o: nella funzione "ImageConverter::~ImageConverter()":
immage_converter.cpp:(.text._ZN14ImageConverterD2Ev[_ZN14ImageConverterD5Ev]+0x36): riferimento non definito a "cv::destroyWindow(cv::String const&)"
CMakeFiles/immage_converter.dir/src/immage_converter.cpp.o: nella funzione "ImageConverter::imageCb(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)":
immage_converter.cpp:(.text._ZN14ImageConverter7imageCbERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE[_ZN14ImageConverter7imageCbERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE]+0x1bf): riferimento non definito a "cv::imshow(cv::String const&, cv::_InputArray const&)"
immage_converter.cpp:(.text._ZN14ImageConverter7imageCbERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE[_ZN14ImageConverter7imageCbERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE]+0x1e4): riferimento non definito a "cv::waitKey(int)"
collect2: error: ld returned 1 exit status
auv/prova/CMakeFiles/immage_converter.dir/build.make:127: recipe for target '/home/valeria/catkin_ws/devel/lib/prova/immage_converter' failed
make[2]: *** [/home/valeria/catkin_ws/devel/lib/prova/immage_converter] Error 1
CMakeFiles/Makefile2:7667: recipe for target 'auv/prova/CMakeFiles/immage_converter.dir/all' failed
If I type
pkg-config --modversion opencv
I get 3.2.0
which I suppose it's opencv 3, right?
what am I doing wrong? thanks