Recover opencv2/ opencv4 folders from /usr/include

I had a lot of problems with my opencv installation and along the way I accidentally deleted the opencv folders in /usr/include. How can I recover them in the right way so that the following error doesn't occur when I try to catkin_make my ros workspaces?

-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Error at /opt/ros/noetic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message):
  Project 'cv_bridge' specifies '/usr/include/opencv4' as an include dir,
  which is not found.  It does neither exist as an absolute directory nor in
  '${{prefix}}//usr/include/opencv4'.  Check the issue tracker
  'https://github.com/ros-perception/vision_opencv/issues' and consider
  creating a ticket if the problem has not been reported yet.
Call Stack (most recent call first):
  /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
  LeGO-LOAM/LeGO-LOAM/CMakeLists.txt:8 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/lukas/workspace/catkin_ws_legoloam/build/CMakeFiles/CMakeOutput.log".
See also "/home/lukas/workspace/catkin_ws_legoloam/build/CMakeFiles/CMakeError.log".
make: *** [Makefile:320: cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

Would it be possible to copy the folders from /usr/local/include to /usr/include since I have those left from the successful installation or will that lead to problems?


Solution 1:

You have to simply use the power of APT to restore /usr/include folder contents:

sudo apt-get install --reinstall \
$(dpkg -S /usr/include/ | sed "s/,//g" | sed "s|: /usr/include||")

The /usr/local/include folder is not controlled by APT, so its restore is not possible by using above command.