Install OpenCV 3 on Mac OS X as a basis

I wanted to make an OS X El Capitan application using OpenCV. I decided to use the latest version 3.0.0 released on June 4, 2015. I installed version 2.4.x using brew, but since version 3 now has a script construct for osx that creates the framework, I wanted to use this method.

After downloading version 3 from OpenCV.org, I opened a terminal window in the opencv-3.0.0 directory and executed the build_framework.py script as follows: platforms / osx / build _framework.py osx (The osx argument tells the script to make a directory called osx for output there framework)

Everything was built without a hitch, so I added the framework built into the osx directory to my project.

To my surprise, my project will not be built without errors. First of all, there were two of the following problems. Here is a screenshot of the first: opencv.hpp Header problem

If the first problem did not appear, the error #ifndef __cplusplus # for each header file in opencv2.framework will be launched.

The header must be compiled as C ++

It turns out the problem was that the C ++ headers needed to be called before the Objective-C headers, so I added a PCH file to the project: Header BuildOrder

In fact, you can add this code to the header file, which needs the opencv.hpp header file, instead of creating a PCH file for the project. You should also be sure that #include, not #import, but they should work.

Once I understood these problems, I still stuck with 39 undefined characters for the x86_64 architecture.

Undefined Symbols

, x86_64, , i386 x86_64 . undefined , OpenCL. OpenCL opencv3. , , build_framework.py script , CMakeLists.txt. , OpenCL: WITH_OPENCL WITH_OPENCLAMDFFT WITH_OPENCLAMDBLAS CMakeLists.txt Orignial

, Mac OS X El Capitan OpenCL, , , . CMakeLists.txt, OpenCL, "AND NOT APPLE", WITH_OPENCL WITH_OPENCLAMDFFT WITH_OPENCLAMDBLAS

CMakeLists.txt Updated

CMakeLists.txt opencv2.framework( , opencv2 opencv3) .

, , , - , , OpenCV 3 Mac OS X. !

+4
1

2 . .

, macOS OpenCL, OpenCV2.framework. liblapack.tbd, libcblas.tbd OpenCL.framework, opencv2.framework, .

, → → :

Binary With Libraries

0

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


All Articles