Compiling OpenCV Samples on Mac OS X 10.8.2

Hi guys, I'm new to OpenCV. I spent a lot of time installing it on my Macbook running 10.8.2, and was successful using the latest version of CMake and OpenCV 2.4.4. However, I cannot find simple methods how to compile the FaceTracker.cpp file contained in the / samples folder inside the opencv directory. I am not sure how to link the necessary libraries to compile and run. I also tried to open the Xcode firmware included in the same folder in order to create it, and it failed because I could not find any OpenCV.frameworks. Can you guys tell me in the right direction how to compile and run? And maybe how to use opencv framework with Xcode?

I searched the forums and Google and could not find anything similar to my problems, and all the information I found was either outdated or too confusing.

Thanks!

+4
source share
2 answers

Download the OpenCV 2.4.4 source code and, inside the root directory, run the following commands:

mkdir build cd build cmake -DBUILD_EXAMPLES=ON ../ make sudo make install 

If this does not work, and if you have OpenCV installed on your system, go to the samples/MacOSX/FaceTracker and run :

 g++ FaceTracker.cpp -o FaceTracker `pkg-config --cflags --libs opencv` -framework Cocoa 

The above command will compile the application after editing the FaceTracker.cpp file and replace all of its #include instructions as follows:

 #include <CoreFoundation/CoreFoundation.h> #include <cv.h> #include <highgui.h> #include <cassert> #include <iostream> 
+6
source

Example FaceTracker deprecated: OpenCV.framework no longer exists for the OpenCV 2.xx series. This sample was proposed during OpenCV 1.1.

When you open an Xcode project, go to build settings and search for other linker flags . You can add the necessary dynamic libraries here ( -lopencv_legacy , etc. Without the dylib extension). You may also need to change the linker search path parameter to include the destination where OpenCV is installed (usually /usr/local/bin ).

0
source

Source: https://habr.com/ru/post/1469407/


All Articles