1. In the Mac terminal, using Brew to install OPENCV3, my OpenCV is installed in/usr/local/cellar/opencv3/3.2.0.
2. Create a new Xcode project, select command Line tool, create a new group within the project directory, and add the dylib containing LIBOPENCV within the/usr/local/cellar/opencv3/3.2.0/lib.
3. Change header search Paths to/usr/local/cellar/opencv3/3.2.0/include in build settings, Library search Paths more/usr/local/ Cellar/opencv3/3.2.0/lib. Note that this cannot be copied online only/usr/local/include or/usr/local/lib, depending on your OPENCV installation address
4. Enter in the main function, you can display the picture, note that the path to the picture is correct, you decide.
#include "OPENCV2/CORE.HPP"
#include "OPENCV2/IMGCODECS.HPP"
#include "OPENCV2/HIGHGUI.HPP"
#include <iostream>
#include <string>
Using namespace cv;
Using namespace std;
int Main (int argc, Char* * argv)
{
String imageName ("/users/mac-jcc/desktop/opencv-00/jcc.png");
Mat image;
Image = Imread(imageName, imread_color);
if(image. Empty())
{
cout<<"could not open or find the image"<<std::endl;
return -1;
}
Namedwindow( "Display window", window_autosize );
imshow( "Display window", image );
waitkey(0);
return 0;
}
Installation and trial of OPENCV in Mac system