install OpenCV in mac
- 1. Install OpenCV into MAC
1. 犖ム cmake 犖犖迦 http://www.cmake.org/cmake/resources/software.html
犖犖ム険犖犖犖迦犖犖園犖犖ム cmake
2. 犖犖迦硯犖犢犖犖ム OpenCV 犖犖迦
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.0/ 犖犖萎犖
犢犖犖ワ OpenCV-2.x.xtar.bz2 犖犖ム険犖犖犖迦犖犖園犖 犢犖犖犢犖犖ワ犢犖э犖犖朽犢犖犖犖犢犢犖
3. 犢犖犖迦犖犢犖犢犖犖ム犖犖犖o OpenCV-2.x.x 犖犖朽犢犖犖犢犖э犢犖ム鍵犢犖犖犢犖迦肩犖園犖犖犖園犖犖朽
mkdir build
cd build
cmake -G "Unix Makefiles" ..
4. 犖犖ム険犖犖犖迦犖犖園犖
make -j8
sudo make install
犖犖迦牽犢犖犖朽権犖犢犖 OpenCV Library 犢犖 xCode
1. 犢犖犖 xCode
2. 犢犖ム厳犖犖 Create Project
3. 犢犖ム厳犖犖 Command Line Tool
4. 犢犖犖犖劇犖 Project 犢犖ム厳犖犖 type 犢犖犖 C++
5. 犢犖ム厳犖犖犖犖朽 Project Build Settings 犢犖ム鍵犢犖犖犢犖迦肩犖園犖犖犖園犖犖朽
犖犖巌検犖犢犖犖犖犖犖犖犖犖 Header Search :
Header Search Paths: /usr/local/include
犖犖巌検犖犢犖犖犖犖犖犖犖犖 Library Search
Library Search Paths: /usr/local/lib
犖犖巌検犖犢犖犖犖犖犖犖犖犖 Linking:
Other Linker Flags: -lopencv_core -lopencv_highgui -lopencv_imgproc
- 2. 犖犖ム険犖犖犖迦犖犖園犖犖犖犖犖犖犖犖園犖犖朽
#import <Foundation/Foundation.h>
#import "opencv/cv.h"
#import "opencv/highgui.h"
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
IplImage* img = cvCreateImage( cvSize( 640, 480 ), IPL_DEPTH_8U, 3 );
cvCircle( img, cvPoint( 320, 240 ), 100, cvScalar( 255, 0, 0 , 255 ), 5, 8, 0 );
cvNamedWindow( "OpenCV Window", CV_WINDOW_NORMAL );
cvShowImage( "OpenCV Window", img );
cvWaitKey(0);
cvDestroyWindow( "OpenCV Window" );
cvReleaseImage( &img );
[pool drain];
return 0;
}
犖犖朽犖÷顕 : http://tilomitra.com/opencv-on-mac-osx/
http://tech.enekochan.com/2012/05/21/use-opencv-in-xcode-4-for-a-mac-os-x-application/