A story about how Windows 10 users created an environment to use OpenCV3 with Python 3.5

(2016.4.6 postscript) Since there was an easier way, I will put a link. http://qiita.com/sugurunatsuno/items/ce3c0d486bdc93688192

I was able to install OpenCV in the same way as Ubuntu in the Windows 10 environment.

Note that there was no article summarizing how to install OpenCV3 on Windows + Python3 (I'm just not good at finding it?).

things to do

Build OpenCV3 in Windows10 environment so that it can be used from Python3.5 (Miniconda).

What I was able to do

I loaded OpenCV3 from Python3.5 as follows.

$ python
Python 3.5.0 |Continuum Analytics, Inc.| (default, Nov  7 2015, 13:15:24) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.0.0-dev'
>>>

Referenced articles

procedure

1. Clone the OpenCV source from Github

$ git clone https://github.com/Itseez/opencv.git

2. Start CMake and specify the location of the OpenCV source you downloaded earlier and the location to generate the solution file to build the source as shown in the figure.

figure1.png

3. Select "Visual Studio 11 2012 Win64" as the compiler (vs2013 or something is fine)

figure2.png

4. Many variables displayed in red will appear, so set the values for the variables related to Python3. Press Configure when the settings are complete

figure4-2.png

5. Only BUILD_opencv_python3 is displayed in red, so check it and configure again.

figure5.png

6. Press Generate to generate the solution file in build

7. Open the solution in Visual Studio 2012 and build with Debug and Release respectively (it takes time)

8. Copy the contents of bin / Release and lib / Release to build / x64 / vc11 / bin and build / x64 / vc11 / lib, respectively.

9. Add the path of build / x64 / bin to the environment variable

10. Confirm that the file cv2.cp35-win_amd64.pyd exists in the path set in PYTHON3_PACKAGES_PATH in step 4.

11. Start Python, import OpenCV and complete when the version can be displayed

$ python
Python 3.5.0 |Continuum Analytics, Inc.| (default, Nov  7 2015, 13:15:24) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.0.0-dev'
>>>

Recommended Posts

A story about how Windows 10 users created an environment to use OpenCV3 with Python 3.5
A story about building an IDE environment with WinPython on an old Windows OS.
Python: How to use async with
How to convert an array to a dictionary with Python [Application]
A story about how to specify a relative path in python.
A story about an amateur making a breakout with python (kivy) ②
A story about how to deal with the CORS problem
How to build a python2.7 series development environment with Vagrant
How to use FTP with Python
A story about an amateur making a breakout with python (kivy) ①
I created an environment for Masonite, a Python web framework similar to Laravel, with Docker!
How to batch start a python program created with Jupyter notebook
A story about adding a REST API to a daemon made with Python
How to make a surveillance camera (Security Camera) with Opencv and Python
How to create a heatmap with an arbitrary domain in Python
[Python] Explains how to use the format function with an example
How to use an external editor for Python development with Grasshopper
Prepare an environment to use OpenCV and Pillow with AWS Lambda
How to use Cmder with PyCharm (Windows)
Building a Python 3.6 environment with Windows + PowerShell
[Python] What is a slice? An easy-to-understand explanation of how to use it with a concrete example.
[Python] Explains how to use the range function with a concrete example
Steps to create a Python virtual environment with VS Code on Windows
[Memorandum] A story about trying OpenCV tutorial (face recognition) in a Windows environment
How to read a CSV file with Python 2/3
How to share a virtual environment [About requirements.txt]
How to create a Python virtual environment (venv)
The easiest way to use OpenCV with python
How to use tkinter with python in pyenv
[Python] How to install OpenCV on Anaconda [Windows]
[Python] How to handle Japanese characters with openCV
How to build an environment when you want to use python2.7 after installing Anaconda3
[Python] How to create a local web server environment with SimpleHTTPServer and CGIHTTPServer
How to convert / restore a string with [] in python
A story about making 3D space recognition with Python
[Python] How to draw a line graph with Matplotlib
How to set up a Python environment using pyenv
How to use python interactive mode with git bash
A story about making Hanon-like sheet music with Python
How to build a Django (python) environment on docker
A story about trying a (Golang +) Python monorepo with Bazel
A story about how theano was moved with TSUBAME 2.0
How to use jupyter lab in Windows 10 local environment
[Python] How to create a 2D histogram with Matplotlib
How to build a Python environment on amazon linux 2
[Python] How to draw a scatter plot with Matplotlib
Building an environment to use CaboCha with google colaboratory
I tried to build an environment with WSL + Ubuntu + VS Code in a Windows environment
Create an exe file that works in a Windows environment without Python with PyInstaller
How to use NUITKA-Utilities hinted-compilation to easily create an executable file from a Python script
A story about an error when loading a TensorFlow model created with Google Colab locally
How to use python multiprocessing (continued 3) apply_async in class with Pool as a member
How to install Python [Windows]
[Python] How to use list 1
How to use Python argparse
Python: How to use pydub
[Python] How to use checkio
[Python] How to use input ()
How to use Python lambda
[Python] How to use virtualenv
python3: How to use bottle (3)