OpenCV源码编译教程推荐(mac平台)

Python

3.6的直接去官网下载就好

接入网址

Original command

注意更改主机的路径:-D OPENCV_EXTRA_MODULES_PATH=/Users/apple/CWorkSpace/OpenCv/opencv_contrib/modules

$ workon cv
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D OPENCV_EXTRA_MODULES_PATH=~/CWorkSpace/OpenCv/opencv_contrib/modules \
    -D PYTHON3_LIBRARY=`python -c 'import subprocess ; import sys ; s = subprocess.check_output("python-config --configdir", shell=True).decode("utf-8").strip() ; (M, m) = sys.version_info[:2] ; print("{}/libpython{}.{}.dylib".format(s, M, m))'` \
    -D PYTHON3_INCLUDE_DIR=`python -c 'import distutils.sysconfig as s; print(s.get_python_inc())'` \
    -D PYTHON3_EXECUTABLE=$VIRTUAL_ENV/bin/python \
    -D BUILD_opencv_python2=OFF \
    -D BUILD_opencv_python3=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D INSTALL_C_EXAMPLES=OFF \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D BUILD_EXAMPLES=ON ..

Error message

error: use of undeclared identifier 'CL_VERSION_2_0'
  return ((int*)(&CL_VERSION_2_0))[argc];

fix

-DWITH_OPENCL=OFF

你可能感兴趣的:(opencv)