When using Manifold 2 to compile Advance Sensing, the stereo-vision-depth-perception-sample will not compile for two reasons:
- It's missing the file: opencv_contrib
- The file: opencv is preinstalled under the ROS installation package.
In order resolve this you will need to install opencv_contrib, reinstall opencv and map the corresponding version of opencv_contrib to a new path - please see the steps below:
Note: You will not need to uninstall the Opencv that came preinstalled with Manifold 2
Step 1: Download opencv and opencv_contrib library
Opencv link: https://opencv.org/releases/page/3/
Opencv_contrib link: https://github.com/opencv/opencv_contrib/tree/3.3.1
Note: the version of both should match each other. For example, both would be version 3.3.1. The version switch of opencv_contrib is updated by changing the tag.
Step 2: Unzip opencv and opencv_contrib. For example - unzip: opencv-3.3.1 and opencv_contrib-3.3.1
Step 3: Move opencv_contrib to the opencv directory as shown in the picture below:
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
Step 5: Enter the opencv directory, create a build directory, and execute the following cmake command:
cmake -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.3.1/modules ..
Note: opencv_contrib-3.3.1 in OPENCV_EXTRA_MODULES_PATH is also the file path name. If the file name changes, the path name also needs to be updated to prevent an error at runtime.