Configure Xcode (4.6.1) and opencvxcode in Opencv (2.4.9) on Mac

Source: Internet
Author: User

Configure Xcode (4.6.1) and opencvxcode in Opencv (2.4.9) on Mac
1: Install homebrew and cmake

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Brew install cmake2: install opencvbrew tap homebrew/sciencebrew install opencv3. use Xcode for OpenCV Project Development

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

2. Name it and selectC++For type

3. Click on your project from the left menu. Click build settingsTab from the top. Filter all. Scroll Search Paths. Under header search paths, For debug and release, set the path /usr/local/include. Under library search paths, Set the pathto $(PROJECT_DIR). Finally, check if C++ standard libraryIs Libc ++ (this is what Xcode uses by default. )Or not, if not, change it to this! Ps: libstdc ++ is required for some xcode and opencv versions. test which version is suitable 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 File -> add Files, Type shift + command + G, which will allow you 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 may need to add other library files from 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>You can modify main. cpp. The Code is as follows. The running result is to display a specified image. # 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 ;}







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.