Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>steps to compile and run c++ opencv 2.4.4 on mac os x lion 10.7.5 with cmake 2.8.10 and xcode 4.6.1</p> <p><strong>Having the right tools</strong></p> <ol> <li>download opencv-unix from <a href="http://sourceforge.net/projects/opencvlibrary/files/" rel="nofollow">http://sourceforge.net/projects/opencvlibrary/files/</a> and untar it wherever</li> <li>download cmake .dmg from <a href="http://www.cmake.org/cmake/resources/software.html" rel="nofollow">http://www.cmake.org/cmake/resources/software.html</a> and install it</li> <li>i am assuming you have xcode 4.6 on os x lion which includes the ios sdk 6.1</li> <li>go to xcode preferences to download and install the Command Line Tools so you have g++ etc.</li> </ol> <p><strong>Use cmake to compile opencv</strong></p> <ol> <li>go to the extracted opencv folder</li> <li><p>create a build directory</p> <pre><code>mkdir build cd build cmake -D WITH_TBB=OFF -D BUILD_NEW_PYTHON_SUPPORT=OFF -D BUILD_FAT_JAVA_LIB=OFF -D BUILD_TBB=OFF -D BUILD_EXAMPLES=ON -D CMAKE_CXX_COMPILER=g++ CMAKE_CC_COMPILER=gcc -D CMAKE_OSX_ARCHITECTURES=x86_64 -D BUILD_opencv_java=OFF -G "Unix Makefiles" .. make -j8 sudo make install </code></pre></li> <li><p>from the build folder, go to bin/ and run one of the tests</p> <pre><code>./opencv_test_stitching </code></pre></li> </ol> <p><strong>Create your own c++ opencv xcode project</strong></p> <ol> <li>fire up xcode and create a new xcode project</li> <li>select Command Line Tool for the type of project under os x</li> <li>open your project's build settings</li> <li>under Architectures, set Architecture to 64-bit intel. also set Valid Architectures to x86_64</li> <li>under Build Options, set Compiler for C/C++ to Default Compiler</li> <li>under Search Paths, set Header Search Paths to /usr/local/include</li> <li>also under Search Paths, set Library Search Paths to /usr/local/lib</li> <li>under Apple LLVM compiler 4.2 - Language set C++ Standard Library to libstd++</li> </ol> <p><strong>Add the compiled opencv libraries to your project</strong></p> <ol> <li>go the the Build Phases tab next to Build Settings tab you were in</li> <li>inside Link Binary With Libraries, click on the + sign and choose Add Other</li> <li>hit the front slash / on your keyboard and enter /usr/local/lib</li> <li>hit enter and select the libraries you want to use in your project</li> <li>make sure you always select libopencv_core.2.4.4.dylib</li> <li>hit enter and you will see the selected dylibs under your project</li> </ol> <p><strong>write some code</strong></p> <ol> <li>first lets organize the files, right click on your project blueprint icon and select New Group</li> <li>name the new group opencv or whatever</li> <li>drag the dylibs and drop them in that group</li> <li>open main.cpp</li> <li>copy code from any of the sample tests that came with opencv and paste it here</li> <li><p>make sure all the required dylibs are added, for example, if you copied the opencv_test_stitching.cpp code into main.cpp, you will need to add the following libraries in the previous steps</p> <ul> <li>libopencv_core.2.4.4.dylib</li> <li>libopencv_highgui.2.4.4.dylib</li> <li>libopencv_stitching.2.4.4.dylib</li> </ul></li> </ol> <p>Cheers.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload