SlideShare a Scribd company logo
1 of 2
Download to read offline
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. เขาไปในโฟลเดอร 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
หลังจากนั้นทดสอบดังนี้
#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/

More Related Content

Viewers also liked

Taller de geometria
Taller de geometriaTaller de geometria
Taller de geometriajohn0378
 
Belleza Del Color
Belleza Del ColorBelleza Del Color
Belleza Del Colorpilarandres
 
Part Nine - Pros And Cons Of Business Ownership
Part Nine - Pros And Cons Of Business OwnershipPart Nine - Pros And Cons Of Business Ownership
Part Nine - Pros And Cons Of Business OwnershipVal Slastnikov
 
Zaragoza S.Xix Xx
Zaragoza S.Xix XxZaragoza S.Xix Xx
Zaragoza S.Xix Xxpilarandres
 
Daniela Fantoni Alvares | Ministério de Turismo (MTUR)
Daniela Fantoni Alvares | Ministério de Turismo (MTUR)Daniela Fantoni Alvares | Ministério de Turismo (MTUR)
Daniela Fantoni Alvares | Ministério de Turismo (MTUR)WCIG
 
História do saneamento em Buenos Aires
História do saneamento em Buenos AiresHistória do saneamento em Buenos Aires
História do saneamento em Buenos Aireselenitamalta
 
IZADA DE BANDERA LA ESPERANZA
IZADA DE BANDERA LA ESPERANZAIZADA DE BANDERA LA ESPERANZA
IZADA DE BANDERA LA ESPERANZApao1998
 
Como trocar o pneu do carro!
Como trocar o pneu do carro!Como trocar o pneu do carro!
Como trocar o pneu do carro!encostaarmando
 

Viewers also liked (11)

Taller de geometria
Taller de geometriaTaller de geometria
Taller de geometria
 
Belleza Del Color
Belleza Del ColorBelleza Del Color
Belleza Del Color
 
Part Nine - Pros And Cons Of Business Ownership
Part Nine - Pros And Cons Of Business OwnershipPart Nine - Pros And Cons Of Business Ownership
Part Nine - Pros And Cons Of Business Ownership
 
Zaragoza S.Xix Xx
Zaragoza S.Xix XxZaragoza S.Xix Xx
Zaragoza S.Xix Xx
 
Sollus Consultoria
Sollus ConsultoriaSollus Consultoria
Sollus Consultoria
 
Presentación de maria elvira r.r.
Presentación de maria elvira r.r.Presentación de maria elvira r.r.
Presentación de maria elvira r.r.
 
Daniela Fantoni Alvares | Ministério de Turismo (MTUR)
Daniela Fantoni Alvares | Ministério de Turismo (MTUR)Daniela Fantoni Alvares | Ministério de Turismo (MTUR)
Daniela Fantoni Alvares | Ministério de Turismo (MTUR)
 
História do saneamento em Buenos Aires
História do saneamento em Buenos AiresHistória do saneamento em Buenos Aires
História do saneamento em Buenos Aires
 
IZADA DE BANDERA LA ESPERANZA
IZADA DE BANDERA LA ESPERANZAIZADA DE BANDERA LA ESPERANZA
IZADA DE BANDERA LA ESPERANZA
 
Como trocar o pneu do carro!
Como trocar o pneu do carro!Como trocar o pneu do carro!
Como trocar o pneu do carro!
 
Alfabeto inclusão 2
Alfabeto inclusão 2Alfabeto inclusão 2
Alfabeto inclusão 2
 

Similar to install OpenCV in mac

Python Dev Setup Thai.pdf
Python Dev Setup Thai.pdfPython Dev Setup Thai.pdf
Python Dev Setup Thai.pdfPaulSombat
 
สร้าง Soap web services ง่ายๆ
สร้าง Soap web services ง่ายๆสร้าง Soap web services ง่ายๆ
สร้าง Soap web services ง่ายๆUtain Wongpreaw
 
Yii framework 2 basic training
Yii framework 2 basic trainingYii framework 2 basic training
Yii framework 2 basic trainingManop Kongoon
 
การติดตั้งและการดาวน์โหลดโปรแกรมภาษาC
การติดตั้งและการดาวน์โหลดโปรแกรมภาษาCการติดตั้งและการดาวน์โหลดโปรแกรมภาษาC
การติดตั้งและการดาวน์โหลดโปรแกรมภาษาCkorn27122540
 
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i os
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i osคู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i os
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i osNisachol Poljorhor
 
IT Trends eMagazine Vol 4. No.12
IT Trends eMagazine  Vol 4. No.12IT Trends eMagazine  Vol 4. No.12
IT Trends eMagazine Vol 4. No.12IMC Institute
 
Multi threaded programming in c and c++ 2021-09-03
Multi threaded programming in c and c++ 2021-09-03Multi threaded programming in c and c++ 2021-09-03
Multi threaded programming in c and c++ 2021-09-03KIMVR1
 

Similar to install OpenCV in mac (12)

IT Skills for Teacher path 2
IT Skills for Teacher path 2IT Skills for Teacher path 2
IT Skills for Teacher path 2
 
Php nuke
Php nukePhp nuke
Php nuke
 
Python Dev Setup Thai.pdf
Python Dev Setup Thai.pdfPython Dev Setup Thai.pdf
Python Dev Setup Thai.pdf
 
สร้าง Soap web services ง่ายๆ
สร้าง Soap web services ง่ายๆสร้าง Soap web services ง่ายๆ
สร้าง Soap web services ง่ายๆ
 
PHPMyLibrary
PHPMyLibraryPHPMyLibrary
PHPMyLibrary
 
Yii framework 2 basic training
Yii framework 2 basic trainingYii framework 2 basic training
Yii framework 2 basic training
 
การติดตั้งและการดาวน์โหลดโปรแกรมภาษาC
การติดตั้งและการดาวน์โหลดโปรแกรมภาษาCการติดตั้งและการดาวน์โหลดโปรแกรมภาษาC
การติดตั้งและการดาวน์โหลดโปรแกรมภาษาC
 
Python Programming for Lecturer_RUS_Nonthaburi 17may2019
Python Programming for Lecturer_RUS_Nonthaburi 17may2019Python Programming for Lecturer_RUS_Nonthaburi 17may2019
Python Programming for Lecturer_RUS_Nonthaburi 17may2019
 
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i os
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i osคู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i os
คู่มือการใช้งานโปรแกรมพัฒนา Application สำหรับระบบปฏิบัติการ i os
 
IT Trends eMagazine Vol 4. No.12
IT Trends eMagazine  Vol 4. No.12IT Trends eMagazine  Vol 4. No.12
IT Trends eMagazine Vol 4. No.12
 
Java script 1
Java script 1Java script 1
Java script 1
 
Multi threaded programming in c and c++ 2021-09-03
Multi threaded programming in c and c++ 2021-09-03Multi threaded programming in c and c++ 2021-09-03
Multi threaded programming in c and c++ 2021-09-03
 

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. เขาไปในโฟลเดอร 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/