2

I'm using this: http://docs.opencv.org/3.1.0/d7/d9f/tutorial_linux_install.html to build opencv on ununtu 16LTS for Python 3. On step 4 in Building OpenCV from Source Using CMake i'm stuck with typing in the right parameters. Could you, please check my variants, because i could only find folders and no files with suggested extensions. Also, shall i type a flag -D before each param?

         -D PYTHON3_EXECUTABLE=$HOME/anaconda3/bin
         -D PYTHON_INCLUDE_DIR=/usr/include/python3.5
         -D PYTHON_INCLUDE_DIR2=/usr/include/x86_64-linux-gnu/python3.5m
         -D PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.a
         -D PYTHON3_NUMPY_INCLUDE_DIRS= I dont have anything similar like path in the tutorial, but i have a "numpy" folder in /usr/include/python3.5!
   So what should i do?

Also, what shall i write in:

  • -D CMAKE_INSTALL_PREFIX
  • OPENCV_EXTRA_MODULES_PATH (in this tutrial(previus step), o downloaded opencv-contrib. So should i type in: OPENCV_EXTRA_MODULES_PATH=/home/vladislav/opencv/opencv_contrib
  • BUILD_DOCS
  • BUILD_EXAMPLES

ERROR: When i run as it is told in the tutorial, i got mistakes like this: CMake Error: The source directory "/home/vladislav/opencv/build/PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so" does not exist.

1 Answer 1

3

That's an example of my working cmake params (Ubuntu 16.04, Latest OpenCV, Python 3.5), but you need to adjust the paths by your own.

cmake -D CMAKE_BUILD_TYPE=RELEASE \        
    -D PYTHON3_EXECUTABLE=/usr/bin/python3.5 \    
    -D PYTHON3_INCLUDE_DIR=/usr/include/python3.5 \ 
    -D PYTHON3_LIBRARY=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/libpython3.5.so \
    -D PYTHON3_NUMPY_INCLUDE_DIR=/usr/local/lib/python3.5/dist-packages/numpy/core/include \
    -D PYTHON3_PACKAGES_PATH=/usr/local/lib/python3.5/dist-packages \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
    -D BUILD_EXAMPLES=ON ..

in my case opencv_contrib is in the same folder like opencv your cmake command starts from your build folder (mkdir build in opencv folder) so in my case I need to jump to dirs back and important: refer to the opencv_contrib/modules folder

Sometimes it's a little bit clearer to use the cmake-gui

sudo apt install cmake-gui

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.