First of all, download and install Microsoft Visual C++ Compiler for Python 2.7 from the Microsoft download page
Install CMake with the binary installer for Windows x64 on the CMake download page..
During installation, select Add CMake to system PATH for all users
.
-
Download the last OpenCV 2.4 release for Windows on the OpenCV download page and extract it somewhere
-
Open the file /sources/modules/core/src/drawing.cpp
-
In this file, replace the 3 occurences of:
_pts.data()
by :
&_pts[0]
- In this file also, replace :
axes.width = std::abs(axes.width), axes.height = std::abs(axes.height);
by:
axes.width = std::abs((int)axes.width), axes.height = std::abs((int)axes.height);
-
Open the "Visual C++ 2008 64-bit Command Prompt" application
-
Go inside the opencv/sources directoryand create a "build_vc9" folder
-
Go inside the build_vc9 folder and run:
cmake -G "NMake Makefiles" ..
- Then just run:
nmake
There you go, you know have compiled OpenCV with VC9.
You know have to add the two following environment variables :
BOOST_ROOT
BOOST_LIBRARYDIR
Set them to whatever the compilation output on Step 4. For instance during my compilation, here is the final output :
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
C:\Users\Angus\Downloads\boost_1_64_0
The following directory should be added to linker library paths:
C:\Users\Angus\Downloads\boost_1_64_0\stage\lib"
So you will set the 2 vars :
set BOOST_ROOT=C:\Users\Angus\Downloads\boost_1_64_0
set BOOST_LIBRARYDIR=C:\Users\Angus\Downloads\boost_1_64_0\stage\lib
Note : these variables are set only for this prompt. If you want to set them permanently, go to the Advanced System Settings
and set the two new vars.
- Install
virtualenv
by running :
pip install virtualenv
- Create a virtualenv by running :
virtualenv dlib-venv
- Then activate it with :
dlib-venv\Scripts\activate
- Install the wheel package by running :
pip install wheel
- If it's not already done, download the last Dlib archive on the Dlib home page and extract it somewhere
- Go inside the dlib directory you just extracted and run :
python setup.py bdist_wheel
After it's finished, that's it, your wheel should have been created ! Go to the newly created dist
directory and you should find the file dlib-X.Y.Z-cp27-cp27m-win_amd64.whl
file which you can install where you want.