OpenCV From Scratch, installation on MacOS
Install OpenCV on MacOS
Here are the steps to install OpenCV on MacOS
0. If you do not have XCode, you should install XCode first.
1. brew install opencv
If you don't have pkg-config on your MacOS, you need to install it
2. brew install pkg-config
If you are lucky, then you can compile your first opencv code.
3. copy the following code save it as first.cpp
#include
using namespace cv;
int main(int argc, char** argv) {
// Read the image file
Mat image = imread("/path/image.png");
return 0;
}
4. Compile it with following command line:
g++ -std=c++11 $(pkg-config --cflags --libs opencv) first.cpp -o first
5. If you are lucky, then you should get a binary file called first.
6. You can run it: ./first