0

OpenCV-Pythonチュートリアル

OpenCV-Pythonチュートリアルの和訳を2.5年ぶりに更新.
和訳は以前と同じURLからアクセス可能です.
ソースはgithubからgitlabに移行しました.
誤訳,変な訳があればgitlabにイシュー登録してもらえるとハッピーです.

0

enable OpenCV-Python compilation with OpenCV 3.2.0

With default CMakeLists.txt, we cannot compile OpenCV-Python with OpenCV 3.2.0 because
1. add_subdirectory() for python2 do not work appropriately
2. add_subdirectory() for python3 do not work appropriately
3. CMakeLists.txt in the root directory does not add python2/3 include directories.

So the solution is here. Let opencv-3.2.0_ROOT denote the root directory of OpenCV 3.2.0. We need to fix 3 files.

1. opencv-3.2.0_ROOT/modules/python/python2/CMakeLists.txt
#1 PYTHON2_INCLUDE_PATH -> PYTHON2_INCLUDE_DIR

2. opencv-3.2.0_ROOT/modules/python/python3/CMakeLists.txt
#1 PYTHON3_INCLUDE_PATH -> PYTHON3_INCLUDE_DIR

3. opencv-3.2.0_ROOT/CMakeLists.txt
add the following lines after #573
if(BUILD_opencv_python2)
ocv_include_directories(${PYTHON2_INCLUDE_DIR})
endif()
if(BUILD_opencv_python3)
ocv_include_directories(${PYTHON3_INCLUDE_DIR})
endif()

0

OpenCV 3.1.0 for Python2.7

 

  • PYTHON2_EXECUTABLE: /opt/anaconda/anaconda2/bin/python2.7
  • PYTHON2_INCLUDE_DIR: /opt/anaconda/anaconda2/include
  • PYTHON2_INCLUDE_DIR2:
  • PYTHON2_LIBRARY: /opt/anaconda/anaconda2/lib/libpython2.7.so
  • PYTHON2_LIBRARY_DEBUG:
  • PYTHON2_NUMPY_INCLUDE_DIRS: /opt/anaconda/anaconda2/lib/python2.7/site-packages/numpy/core/include
  • PYTHON2_PACKAGES_PATH: /opt/anaconda/anaconda2/lib/python2.7/site-packages