February 19, 2017

Install Python 3 and OpenCV on Windows

In this post I will describe the easiest way of installing Python 3 and OpenCV library on Windows for face detection and recognition.

Install Python 3

Go to the Python download page and download the latest version of Python 3 for Windows. This example has been tested with Python 3.6.

Launch the installer and ensure the 'Add Python to PATH' checkbox is selected.
Wait for the installation to complete, open a Command Prompt and type 'python'. You should see something like this.

C:\Python>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

Type 'quit()' to exit the python shell.


Install OpenCV library

If you just need the face detection (no recognition) all you need is the basic OpenCV library. It can be easily installed with no hassle with pip command.

pip install opencv-python


Install OpenCV library with contrib module

To be able to use the face recognition algorithms, you will need the 'contrib' module that is not included in the standard OpenCV build. Many people suggest to build the library manually to solve the problem but there is a simpler solution documented in this post.

Download the appropriate opencv+contrib .whl file from this page. The file to download should be: opencv_python-3.2.0+contrib-cpXX-cp36m-winYYY.whl. Where XX is your Python version and YYY is your Windows 32/64 bit flavor.
For example, assuming you have Python 3.6 running on Windows 64 bit you must download: opencv_python-3.2.0+contrib-cp36-cp36m-win_amd64.whl

Now open a Command Prompt with admin rights and type the following command to install:

pip install opencv_python-3.2.0+contrib-cp36-cp36m-win_amd64.whl


Test face detection

You can now move on to the face detection example.

2 comments:

  1. If you want your ex-girlfriend or ex-boyfriend to come crawling back to you on their knees (even if they're dating somebody else now) you need to watch this video
    right away...

    (VIDEO) Why your ex will NEVER come back...

    ReplyDelete
  2. Excellent website you have here: so much cool information!.. Window Installer

    ReplyDelete