TP-traitement-image/DEP_OSX.md
2022-09-18 16:51:07 +02:00

2.5 KiB

OSX

These are the steps to build all you need for the TP.

Prerequisites

Setting up your working environment

  • create a folder tpTI where you will have all the dependencies and the sources of the tp. Please avoid paths containing spaces, weird characters or accents.

  • to make your life easier, set up an environment variable that refer to this location

    • You can define it for a single session with (e.g.) export tpTIBasePath=/home/sgaspari/dev/tpTI

    • or you can define it once for all by adding the previous instruction to your ~/.profile file, so that you don't need to run the instruction for each terminal session.

    • you can verify that the variable is set with echo ${tpTIBasePath}

opencv

OpenCV is a computer vision library that contains some of the algorithms we are using for image processing and pose estimation. To install it:

  • download the library from the repository https://github.com/opencv/opencv/archive/3.4.13.zip

  • unzip the file into ${tpTIBasePath} (a folder named opencv-3.4.13 should appear).

  • from ${tpTIBasePath}\opencv-3.4.13 create a build directory (mkdir build)

  • from the shell, go to ${tpTIBasePath}/opencv-3.4.13/build and execute the following:

    cmake .. -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/install -DCMAKE_BUILD_TYPE=Release -DWITH_CUDA:BOOL=OFF -DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF
    
  • then build and install the library by running

    make install -j4 
    

    You can replace 4 with the number of threads that you machine can support, it will speed up the building. Then go grab a cup of coffee or a beverage of your choice ;-)

  • in order to run the tp code later on you have to add the built libraries to the DYLD_LIBRARY_PATH environment variable.

    export DYLD_LIBRARY_PATH=${tpTIBasePath}/opencv-3.4.13/build/install/lib:$DYLD_LIBRARY_PATH
    

    Again, you can add this to your ~/.profile file so that you have it available for all shell sessions.