일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 빅 데이타
- 김양재
- WebGL
- Statistics
- 몽고디비
- 확률
- 김양재 목사
- 빅 데이터
- Artificial Intelligence
- 통계
- c++
- Deep learning
- 김양재 목사님
- openCV
- data science
- 데이터 과학
- 딥러닝
- probability
- Machine Learning
- 빅데이터
- 우리들교회
- node.js
- 주일설교
- nodeJS
- R
- MongoDB
- Big Data
- No SQL
- 인공지능
- 빅데이타
- Today
- Total
Scientific Computing & Data Science
[OpenCV] Setting OpenCV Development Environment in Xcode 본문
[OpenCV] Setting OpenCV Development Environment in Xcode
cinema4dr12 2013. 10. 30. 23:27Written by CINEMA4D
In this article I'm going to explain how to set up OpenCV development environment in Xcode.
I got most of the information from https://sites.google.com/site/learningopencv1/installing-opencv.
My test environment is as follows (latest versions at this writing):
- Mac OS X 10.9 (Mavericks)
- Xcode 5.0.1 (5A2053)
- OpenCV 2.4.6
- Execute Terminal application
- Input the followings:
- sudo port -v selfupdate
- sudo port install subversion
- sudo port install cmake
- cd /Users/USER_NAME/Documents/XCode/opencv-2.4.6 (any place of your OpenCV folder)
- mkdir build (or you can make 'build' folder in your OpenCV folder)
- cd build
- cmake -G "Unix Makefiles" ..
- make -j8
- sudo make install
- sudo port install opencv
The final step - sudo port install opencv would take considerable time to finish so you can take a rest a while or drink many cups of coffee :)
After all these steps you might check openCV headers and library files in this path:
- headers: /opt/local/include/opencv
- libraries: /opt/local/lib/
The library files have extension of *.dylib and theirs name start with libopencv.
5. Test with a test project in Xcode
- Run you Xcode application
- Select 'Create a new Xcode project' from Welcome message
- When asking template of the new project, choose OS X > Command Line Tool
- Input your Product Name, Organization Name, Company Identifier as your will.
In this example I input 'OpenCVTest' as the Product Name.
- Set Type as C++
- Save your project any place you want
- If you click your project on the left sidebar(OpenCVTest 1 target, OS X SDK 10.9) you can see Build Settings on the main window
- On Build Settings scroll down until you can see Search Paths
- In Header Search Paths input '/opt/local/include' for both Debug and Release
- In Library Search Paths input 'opt/local/lib' for both Debug and Release
- Add OpenCV frameworks
Right click on your project(OpenCVTest 1 target, OS X SDK 10.9) on the leftside bar and select New Group naming it 'OpenCV Frameworks'
- Right click on OpenCV Frameworks group you have just added and select Add Files to "OpenCVTest"... to add openCV libraries
- If file selector pops up set the path as '/opt/local/lib' to select 'libopencv_core.2.4.6.dylib' and 'libopencv_highgui.2.4.6.dylib' files, which are the required libraries for the test example
- You can see the two libraries added into your OpenCV Frameworks group on the left sidebar
- Every preparation has been done except for making your test code
- On the left sidebar choose main.cpp and you will see the code lines on the main window (If you double click it another window will pop up so just one click would be enough)
- Next to '#include <iostream>' type '#include <opencv2/opencv.hpp>'. During typing if auto-complete functionality does not show up your Xcode might fail to search either header or library path. In this case check your path in Search Paths again.
- Type test code:
int main(int argc, char *argv[]) {
// Open the file. IplImage *img = cvCreateImage( cvSize(100,200), IPL_DEPTH_8U, 3);
// Display the image. cvNamedWindow("Image:", CV_WINDOW_AUTOSIZE); cvShowImage("Image:", img);
// Wait for the user to press a key in the GUI window. cvWaitKey(0);
// Free the resources. cvDestroyWindow("Image:"); cvReleaseImage(&img);
return 0; }
- Check the result
If everything is OK build and run to see this result:
- Although this test example shows very dull result it may be good enough as your starting program of computer vision using OpenCV
'Programming > OpenCV' 카테고리의 다른 글
[OpenCV] MFC-OpenCV 연동하기 (9) | 2014.06.10 |
---|---|
[OpenCV] Windows / Visual Studio에서 OpenCV 개발환경 구축하기 (0) | 2014.04.02 |
[OpenCV] Mac OS X / Xcode에서 OpenCV 개발환경 구축하기 (9) | 2014.04.02 |
[OpenCV] Optical Flow / Lucas-Kanade Method (0) | 2013.06.24 |
[OpenCV ] Accelerated Computer Vision using GPUs (0) | 2013.05.26 |