>

2016년 9월 4일 일요일

Using OpenCV3.x in OpenFrameworks0.9.3, Mac OS X

0. Well, you need to install opencv3.1 somewhere in your computer. In my case, I installed it in /usr/local/ocv3 because I have opencv2.x version previously installed. All the opencv3.x files are in /usr/local/ocv3.

1. In your Xcode project, find the file Project.xconfig, and put the search path as shown in the image below.

2. Likewise, put the library files in the opencv3 folder, which was created by yourself.


3. Now, you can use opencv in openframeworks.


In the following, 
 - An image named 'bikers.jpg' is loaded into bikersImage, which is an instance of ofImage
 - The image information of bikersImage  is put into cvImg, which is an instance of cv::Mat
 - In ofApp::update() function, some image processing is applied to cvImg. In this case cv::blur() enforces box filtering.
 - To display the filtered result on the screen, you need bikersImage.update(), which updates its texture memory for display. 
 - In ofApp::display() function, the command bikersImage.update(0,0) will show you a very much blurred image, I am sure.


EOF

댓글 없음:

댓글 쓰기