sudo apt update && sudo apt install -y cmake g++ wgetCreate a directory for OpenCV installation:
cd ~
mkdir opencv
cd opencvDownload OpenCV core modules:
wget -O https://github.com/opencv/opencv/archive/refs/tags/4.7.0.tar.gzDownload OpenCV extra modules:
wget -O https://github.com/opencv/opencv_contrib/archive/refs/tags/4.7.0.tar.gztar -xzf opencv-4.7.0.tar.gz
tar -xzf opencv_contrib-4.7.0.tar.gz The directory structure after extraction should be like this:
.
├── opencv-4.7.0
├── opencv-4.7.0.tar.gz
├── opencv_contrib-4.7.0
└── opencv_contrib-4.7.0.tar.gz
2 directories, 2 files
You can remove *.tar.gz files if you want.
mkdir build
cd buildcmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.7.0/modules ../opencv-4.7.0make -j8sudo make install