make opencv2/opencv.hpp not found

I am trying to build fastfusion from this repo: . 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.

2 Answers

use this

/usr/local/include/opencv2**

or

/usr/include/opencv2**
sudo ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like