Skip to content

Instantly share code, notes, and snippets.

@a-maumau
Last active August 20, 2019 01:40
Show Gist options
  • Save a-maumau/767e74995158773b99df379fde202bae to your computer and use it in GitHub Desktop.
Save a-maumau/767e74995158773b99df379fde202bae to your computer and use it in GitHub Desktop.
Installing and using openCV on Mac

Install opencv4 from source

git clone https://github.com/opencv/opencv.git
cd opencv
mkdir build
cd build
cmake ../
make -j 8 # what ever you want
sudo make install

Install pkg-config
brew install pkg-config

pkg-config path (might not needed)
add a path to you shell's .rc
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/

Compile using pkg-config

# you need -std=c++11, and set .pc name which is named opencv4.pc, it is opencv"4".pc, it needs 4 man!!
g++ main.cpp -std=c++11 `pkg-config --cflags --libs opencv4`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment