make opencv2/opencv.hpp not found

5,424
sudo ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2

with linked, in ubuntu20.04, this problem can be solved.

Share:
5,424

Related videos on Youtube

Redwanul Sourav
Author by

Redwanul Sourav

Updated on December 16, 2022

Comments

  • Redwanul Sourav
    Redwanul Sourav over 1 year

    I am trying to build fastfusion from this repo: https://github.com/tum-vision/fastfusion . In the installation step, after running CMake ., I have to run make. But the make command fails with the following error message:

    /home/redwanul/fastfusion/src/camerautils/camerautils.hpp:12:10: fatal error: opencv2/opencv.hpp: No such file or directory
       12 | #include <opencv2/opencv.hpp>
          |          ^~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    

    I have searched for some solutions online. And I have found that I have the file opencv.hpp in the following directories.

    /usr/include/opencv4/opencv2/opencv.hpp
    /usr/local/include/opencv4/opencv2/opencv.hpp

    So I understood that the directory opencv4 in the middle is causing problems. So I copied the folder opencv2 out of opencv4 and placed them in /usr/include/ and /usr/local/include. This time the make does not shows the error. But it fails with another message:

    /home/redwanul/fastfusion/src/auxiliary/plywriter.cpp:171:88: error: ‘type’ is not a member of ‘cv::DataType<cv::Vec<float, 3> >’
      171 | arityImage.rows,disparityImage.cols,cv::DataType<cv::Vec3f>::type);
          |
    

    So far I am understanding that it is a opencv related error. So I think I have to install opencv a specific version. But I don't know which version or how. I tried sudo apt-get install opencv but the there are not package named opencv.

    I am on Ubuntu 20.04.