0

I am using OpenCv 3.4.0, Python 3.6.4, Cmake 3.10.2, OpenNI-Windows-x64-2.2, SensorKinect093-Bin-Win32-v5.1.2.1, Visual Studio 2015 and Windows 10. I want to build the cv2.pyd for Python 3.6.4.

I follow the step in many others way such as github and OpenCV install opencv_contrib on Windows

After configure in the Cmake, It shows the output about python 3 like this:

 Python (for build):            C:/Users/zhong/AppData/Local/Programs/Python/Python36-32/python.exe

And the Cmake havn't the BUILD_opencv_python3, PYTHON3_INCLUDE_DIR and PYTHON3_LIBRARY, so I append the Bool value of BUILD_opencv_python3 and the locations of PYTHON3_INCLUDE_DIR, PYTHON3_LIBRARY manually. The locations are as followings:

PYTHON3_EXECUTABLE     C:/Users/zhong/AppData/Local/Programs/Python/Python36-32/python.exe
PYTHON3_INCLUDE_DIR    C:/Users/zhong/AppData/Local/Programs/Python/Python36-32/include
PYTHON3_INCLUDE_DIR2      
PYTHON3_LIBRARY        C:/Users/zhong/AppData/Local/Programs/Python/Python36-32/libs/python36.lib
PYTHON3_LIBRARY_DEBUG    
PYTHON3_NUMPY_INCLUDE_DIRS  C:/Users/zhong/AppData/Local/Programs/Python/Python36-32/lib/site-packages/numpy/core/include
PYTHON3_PACKAGES_PATH  C:/Users/zhong/AppData/Local/Programs/Python/Python36-32/Lib/site-packages

After that, Cmake can't find the Libraries of Python3, albeit it have the correct location of PYTHON3_LIBRARY. The output about Python3 in Cmake like this:

Python 3:
    Interpreter:                 C:/Users/zhong/AppData/Local/Programs/Python/Python36-32/python.exe (ver 3.6.4)
    Libraries:                   NO
    numpy:                       C:/Users/zhong/AppData/Local/Programs/Python/Python36-32/lib/site-packages/numpy/core/include (ver 1.14.0)
    packages path:               C:/Users/zhong/AppData/Local/Programs/Python/Python36-32/Lib/site-packages

  Python (for build):            C:/Users/zhong/AppData/Local/Programs/Python/Python36-32/python.exe

How can I configure the python 3.6.4 with Cmake correctlly? I want to use deep camera so I have to compile the Opencv with OPENNI2.

I am looking for help how can I solve it? Thank you very much.

Bobby BU
  • 9
  • 1
  • 4
  • 2
    Welcome to Stack Overflow! Here we expect error messages described the problem to be **in the question post itself as text**, not linked as images. Please, edit your question post and correct this. (After copy-pasting error message to the question post, you may format it with `{}` button.) – Tsyvarev Feb 02 '18 at 08:17
  • I am so sorry !! It is my first time use Stack Overflow and I don't know how to show the image...I will try to edit it correctly – Bobby BU Feb 02 '18 at 08:27
  • Why not just `pip install opencv-contrib-python` ? – Dmitrii Z. Feb 02 '18 at 08:56
  • Thanks for your suggestion.Because I want to use deep camera such as Kinect with OPENNI2. So I have to build the cv2.pyd – Bobby BU Feb 02 '18 at 09:02

2 Answers2

0

I give up the python 3, and install the python 2.7.14, OpenCV 3.2.0 instead.

Following the step in OpenCV install opencv_contrib on Windows is easy to install...

It take me too much time to install, I suppose that OpenCV 3.4.0 do not support for Python 3.6.4.

Bobby BU
  • 9
  • 1
  • 4
0

I just found this site which contains instructions: https://www.scivision.co/install-opencv-python-windows/

I was able to use the "pip install opencv-contrib-python" command to have it auto downloaded and installed. I am using Python 3.7 (but it should also work for the version you listed) and have an anaconda environment activated. If you use anaconda, just make sure you install pip for the environment you are using and activate it before using the pip install command.

JakeJ
  • 2,361
  • 5
  • 23
  • 35