Post date: Feb 15, 2015 6:12:17 AM
I followed Tilo Mitra's very helpful post.
1. Download OpenCV.
2. Install Macports.
3. Open Terminal, and type:
sudo port selfupdate
This will update the list of ports that can be installed.
4. Now install cmake. From Terminal, type:
sudo port install cmake
5. Generate makefiles. Create a subdirectory under the root OpenCV directory called "build". Generate makefiles using:
cd build
cmake -G "Unix Makefiles" ..
This will generate makefiles in the build/directory.
6. Build OpenCV: type:
make
To install OpenCV libraries, type:
sudo make install
7. Try out the Display Image Tutorial . Start a new Xcode Command Line Tool. Call it DisplayImage. To build it, follow these steps.
a) Right click on the project and hit "/" when Finder comes up. Go to the directory "/usr/local/lib". Choose all the dynamically linked libraries: these are the starting with "opencv" and ending with "3.0.0.dylib".
b) add the paths to help Xcode locate include and library files. Right click on the project name, and under "build settings" for all, look for "search paths". Add "/usr/local/include" to the include search path, and "/usr/local/lib" to library search path.
c) Copy the source code verbatim from the Display image Tutorial into the file "main.cpp" (overwriting what exists in it).
d) I like to have Xcode put the result in a place where I can find it easily. Under Xcode Preferences, look for "Build locations". Set derived data to "relative", and click on "advanced". Set build location to "legacy". Xcode will now put the built application in the same folder as the project, under "build/".
e) At this point, build the app!
f) To run it, open Terminal, and go to the build/ folder where your app is located (Debug is the default). Place an image there to test the display program. Run the program:
./DisplayImage <yourimagename.jpg>
To exit the program, go to the display window and hit any letter.
Posted 14 Feb 2015.