Installing OpenCV on Mac OSX 10.10

Source: Internet
Author: User

On mac OSX, if you want to use OPENCV, you can manually compile the source code by yourself, but more cumbersome.
It is recommended to use homebrew to install, the steps are simple, as follows:

1. Brew Tap Homebrew/science

2. Brew Install OpenCV

Wait a few minutes for the installation to succeed.

Here's how to configure eclipse:

1. Follow the normal steps of using Eclipse to build a Mac C + + project that contains a CPP file。
 #include < iostream> #include <opencv2/opencv.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv/ Cvaux.hpp> #include <fstream>using namespace std; #define BYTE unsigned charint main (int argc, const char * argv[]) {//Insert code here ... #if 1//get the image from the directed path iplimage* img = cvloadimage ("/users/k           Irchhoff/twd.png ", 1);           NSLog (IMG);           Create a window to display the image Cvnamedwindow ("Picture", 1);           Show the image in the window cvshowimage ("Picture", IMG);           Wait for the user to hit a key Cvwaitkey (0);           Delete the image and Window cvreleaseimage (&img); Cvdestroywindow ("picture"); #endif//return return 0;} 
2. Right-click on the project name, select "Properties", select it in the property configuration page, click c + + Build, and select Settings from the dropdown options. Select Tool Settings in the tab on the right.
3. Select includes in the GCC C + + Compiler Options list to add the installed OpenCV header file directory in the Include Paths (-L):/usr/local/cellar/opencv/2.4.9/include
4. In the MacOS X c++linker option list, select Library and add the installed OpenCV lib file directory in the library search path (-l):/usr/local/cellar/opencv/2.4.9/ Lib
5. Select the library in the MacOS X c++linker option list, and in libraries (-L), click the "+" sign to add the Lib file you want to use (typically, the first three):
Opencv_core opencv_imgproc Opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect Opencv_contrib opencv_legacy Opencv_flann
6. Re-build all project, ~~* ^_^ *

Installing OpenCV on Mac OSX 10.10

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.