Mac OpenCV (2.4.9) configuration Xcode (4.6.1)

Source: Internet
Author: User
Tags install homebrew

1: Install Homebrew and CMake
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Brew Install Cmake2: Installs Opencvbrew tap homebrew/sciencebrew install OPENCV3. Using Xcode for OPENCV project development

1.Open Xcode, chooseNew -> New Project -> Command Line Tool

2.Name it and select for C++ type

3.Click on your project from the left menu. Click the build settingstab from the top. Filter all. Scroll to Search Paths. Under header search paths, for debug and release,set the path to /usr/local/include. Under library search paths, set the Pathto $(PROJECT_DIR). Finally, check if C++ standard libraryIs libc++(Xcode默认的就是这个 )Or not,if not, change it to This!ps: some versions of Xcode and OPENCV need to be libstdc++, please test which one is right for you. 4.Click on your project from the left menu. File->New->New Group, Name the group OpenCV Frameworks. 5.Select the folder (group) you just labeled, OpenCV FrameworksIn the left menu. Go to File -> add Files, Type SHIFT + command +g, which to manually go to a folder. Go to /usr/local/lib6.Select both of these files, libopencv_core.dylib, libopencv_highgui.dylib, and click Add. (You could need to add the library files from the This folder to run other code.) 7.You must include this line of code in the beginning of your main.cpp file: #include <opencv2/opencv.hpp>can modify the main.cpp, the code is as follows, the result is to display a specified picture #include <opencv2/opencv.hpp> usingnamespace cv; intMain(intargc,Char ** argv){ Matimage; Image = Imread("/users/hujiawei/pictures/others/other_naicha/naicha.jpg",1      namedwindow ( " Display Image " window_autosize      imshow ( " Display Image " image      waitkey ( 0 return0; }







Mac OpenCV (2.4.9) configuration Xcode (4.6.1)

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: info-contact@alibabacloud.com 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.