ros-perception / depthimage_to_laserscan

Converts a depth image to a laser scan for use with navigation and localization.
257 stars 172 forks source link

Failed to compile: /opt/ros/melodic/include/image_geometry/pinhole_camera_model.h:5:10: fatal error: opencv2/core/core.hpp: No such file or directory #56

Open EdMlt opened 3 years ago

EdMlt commented 3 years ago

Hi, I wanted to use the depth_image_to_laserscan packagewith my intel realsense. Therefore I pulled this repo in my catkin_ws/src folder and when I try to catkin_make, it fails when coming to this package, here is the stack: `[ 9%] Built target depthimage_to_laserscan_gencfg [ 18%] Building CXX object depthimage_to_laserscan/CMakeFiles/DepthImageToLaserScan.dir/src/DepthImageToLaserScan.cpp.o [ 36%] Built target rviz_click_to_2d In file included from /home/palojetson/Documents/palobot/catkin_ws/src/depthimage_to_laserscan/include/depthimage_to_laserscan/DepthImageToLaserScan.h:40:0, from /home/palojetson/Documents/palobot/catkin_ws/src/depthimage_to_laserscan/src/DepthImageToLaserScan.cpp:34: /opt/ros/melodic/include/image_geometry/pinhole_camera_model.h:5:10: fatal error: opencv2/core/core.hpp: No such file or directory

include <opencv2/core/core.hpp>

      ^~~~~~~~~~~~~~~~~~~~~~~

compilation terminated. depthimage_to_laserscan/CMakeFiles/DepthImageToLaserScan.dir/build.make:62: recipe for target 'depthimage_to_laserscan/CMakeFiles/DepthImageToLaserScan.dir/src/DepthImageToLaserScan.cpp.o' failed make[2]: [depthimage_to_laserscan/CMakeFiles/DepthImageToLaserScan.dir/src/DepthImageToLaserScan.cpp.o] Error 1 CMakeFiles/Makefile2:1824: recipe for target 'depthimage_to_laserscan/CMakeFiles/DepthImageToLaserScan.dir/all' failed make[1]: [depthimage_to_laserscan/CMakeFiles/DepthImageToLaserScan.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j4 -l4" failed` Tried many things, it seems my opencv2 is installed, I don't know from where is the issue

Thank you for the help! :D

eddiem3 commented 2 years ago

I had the exact same error and then a series of errors afterward. I resolved this by editing the CMakelists.txt. I uncommented line 4:

find_package(OpenCV REQUIRED)

and I also added

include_directories(${OpenCV_INCLUDE_DIRS})