1

I wish to get OpenCV working on my Windows 7 x64 for Python 3.4. Even though the OpenCV 3 Alpha page states that there is Python 3 support (http://opencv.org/opencv-3-0-alpha.html), the pre-compiled package only contains opencv/build/python/2.7 and no 3(.4).

So following the answer on How to use OpenCV in python 3.4 on windows 7 x64?, I'm trying to build OpenCV 3.0.0 from source following the following tutorial: http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html.

However since this tutorial is a bit outdated, I've some problems following certain steps.

  • The OpenNI link is dead, so I installed KinectSDK-v1.6-Setup.exe (https://www.microsoft.com/en-us/download/details.aspx?id=34808) and OpenNI-Windows-x64-2.2.msi (http://structure.io/openni). Is this good enough?
  • The Qt framework link is dead. I have Visual Studio 2013, so do I need this? or how do I just get the required files without downloading the whole Qt development kit (http://www.qt.io/)?
  • CMake: I got the latest version from OpenCV from Github, but it doesn't have the folders "Source" and "Builds", so what do I select as folders in CMake (3.2.2)? Sorry I'm new to this.

Any help is greatly appreciated (or a link to a compiled Python 3.4 cv2.pyd)

opencv.org: http://answers.opencv.org/question/60190/building-opencv-300-beta-windows-python-34/

Community
  • 1
  • 1
NumesSanguis
  • 5,832
  • 6
  • 41
  • 76
  • Regarding the bit of cmake: you have to set as source the main directory of OpenCV, and as build a directory you newly create elsewhere. Don't forget to select a proper toolchain from the `platforms` subdirectory. BTW, everything is easier if you use cmake-gui – Antonio Apr 20 '15 at 18:45
  • OpenNI and Qt framework is optional. Follow the part2 of the youtube video on the opencv windows install webpage to setup cmake. – XWen Apr 21 '15 at 12:58

1 Answers1

2

I share precisely your frustrations. Ridiculous of a major package to demand that its users jump through so many hoops, building it from source, simply to use it as an import cv2 in Python. My other packages I just install in one line from pip!

The ticket on the OpenCV bug tracker documenting progress on having a compiled Python 3.4 cv2.pyd file included in the OpenCV 3.0 download on the OpenCV site. As of 6 June 2015 it's not there yet.

However, the great news is, Christoph Gohlke maintains Windows binaries for many Python packages, including OpenCV 3.0 with Python 3.x bindings! See here:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

To install, just download the 64-bit or 32-bit .whl file appropriate for your system, then run pip install [filename]. Then the instruction import cv2 should work in your Python 3.x interpreter.

Michael Currie
  • 13,721
  • 9
  • 42
  • 58