Skip to content

Instantly share code, notes, and snippets.

@sigmadream
Forked from CheeseStick/how-to.md
Created September 8, 2017 02:25
Show Gist options
  • Save sigmadream/f1a7778eeaeab79f9888a3292976e438 to your computer and use it in GitHub Desktop.
Save sigmadream/f1a7778eeaeab79f9888a3292976e438 to your computer and use it in GitHub Desktop.
Mac OS X에서 OpenCV 설치 및 Xcode Project 설정방법

Mac OS X에서 Open CV 설치 및 Xcode에서 사용하기

1. Homebrew를 통해 openCV 설치

(홈브루가 설치되어 있지 않다면 https://brew.sh/index_ko.html 참고)

brew update
brew install opencv

2. Xcode 프로젝트 설정

1. Xcode에서 C++ Command Line 프로젝트 생성

2. Build Settings에서 Header Paths에 아래 path 추가

/usr/local/include

3. Build Settings에서 Library Search Path에 아래 path 추가

/usr/local/lib

4. 링커에 필요한 플래그 추가

1. 터미널을 열고 OpenCV가 설치된 경로로 이동

Example:

cd /usr/local/Cellar/opencv
2. 사용 할 버전의 openCV 폴더 내에 존재하는 package configuration 파일을 pkg-config 명령어를 통해 Linker Flag 출력

Example:

pkg-config --cflags --libs ./3.3.0_3/lib/pkgconfig/opencv.pc
3. 위의 결과로 출력된 링커 플래그를 Build Settings의 Other Linker Flags에 추가

Example:

-I/usr/local/Cellar/opencv/3.3.0_3/include/opencv -I/usr/local/Cellar/opencv/3.3.0_3/include -L/usr/local/Cellar/opencv/3.3.0_3/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_photo -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dpm -lopencv_face -lopencv_fuzzy -lopencv_img_hash -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_ml -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_flann -lopencv_xobjdetect -lopencv_imgcodecs -lopencv_objdetect -lopencv_xphoto -lopencv_imgproc -lopencv_core

3. References

  1. https://medium.com/@dkw5877/opencv-on-os-x-sierra-436f4adbb463
@brewagebear
Copy link

감사합니다 ㅎㅎ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment