NOTE: Folder names may vary and may need tweaking
- Open terminal and check for xcode tools
xcode-select --install
- Run:
brew install opencv
(It will take some time) - It's installed location is:
cd /usr/local/Cellar/opencv
and locate for opencv4 folder
( For linux its almost same )
- Insatll make
brew install make
- Install cmake
brew install cmake
- Download opencv .zip from github
- Unzip it in
~
home dirctory - Go to unziped folder and follow:
mkdir -p build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_C_EXAMPLES=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_GENERATE_PKGCONFIG=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \ -D BUILD_EXAMPLES=ON ..
make -j8
sudo make install
- Remove the opencv folder from home directory
- It's installed location is
cd /usr/local/include/
and locate for opencv4 folder
For VS Code
- Open configuration pallate, then open the c_cpp_properties.json file from .vccode
- Add the OpenCV lib path:
/usr/local/Cellar/opencv/4.5.2_4/include/opencv4/**
( In my case)
Nice