Göm meny

OpenCV Installation Windows


Cmake is a cross-platform, open-source build system.

Download and install the latest stable binary version:



Java run time environment is needed for Eclipse to work.

Download and install it:



Download Eclipse IDE for C/C++ Developers:


Installation instructions:


Doxygen (optional)

Follow these instructions to install Doxygen for use in Eclipse



Download and install the scientific-oriented Python Distribution Python(x,y):


This distribution contains the MinGW compiler toolchain, which will be used by Cmake and Eclipse.

Download and install the OpenCV plugin update as well:


TBB (Optional)

Intel © Threading Building Blocks ( TBB ) download the source files:


Extract it inside a directory likeC:\TBB\tbb40_20120613oss

Open a shell ( Start -> type 'cmd' in the Search programs and files field )

Navigate to the top-level directory of the TBB library, and build it:

make compiler=gcc arch=ia32

Add a system environment variable TBBDIR : C:\TBB\tbb40_20120613oss

Add %TBBDIR%\build\windows_ia32_gcc_mingw4.5.2_release to the system PATH

Eigen (Optional)

Eigen is a C++ template library for linear algebra.


Extract it into a directory like C:\Eigen\eigen-eigen-43d9075b23ef

No need to build anything.

Qt (Optional)

Download the Qt library source:


Extract it into a directory like C:\Qt

Open a shell, cd to the directory containing the extracted Qt files and enter the following command:

configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools
              -no-qt3support -no-multimedia -no-ltcg

This will take around 10 minutes. Then enter the next command that will take a lot longer (can easily take even more than a full hour):


Create a system environment variable QTDIR : C:\Qt\qt-everywhere-opensource-src-4.8.2

Add %QTDIR%\bin at the front of the system PATH.

MikTeX (Optional)

MikTeX is needed for building the documentation.


Download OpenCV:


Extract it into a directory like C:\OpenCV\OpenCV-2.4.2

Start the Cmake GUI (cmake-gui) and select the directory for the source files of the OpenCV library (C:/OpenCV/opencv-2.4.2) and specify a directory where you will build the binary files (C:/OpenCV/opencv-build)

Press the Configure button to specify the compiler (and IDE) you want to use, choose:

Eclipse CDT4 - MinGW Makefiles

Click the Configure button. Check that EIGEN_INCLUDE_PATH, CMAKE_SH has correct paths, and that WITH_CUBLAS, WITH_CUDA, WITH_CUFFT, WITH_OPENEXR are unselected.

Check that ENABLE_SOLUTION_FOLDERS, WITH_QT and WITH_TBB are selected.

Click the Configure button again, and then (when all entries are ok) click the Generate button.

Build OpenCV

Start the Eclipse IDE, and load the generated eclips project:

File -> import -> General -> Existing projects into workspace

Select root directory: C:\OpenCV\opencv-build

Open the workbench, and click on the OpenCV-Release@opencv-build in the Project Explorer

Start the build: Project -> Build Project

Now all binaries and dll's should be available in C:\OpenCV\opencv-build\bin

Install: Project -> Make Target -> Build ...   and select ':install' in the list (at the bottom)

Click the Build button.

Create a system environment variable OPENCV_DIR : C:\OpenCV\opencv-build\install

Add %OPENCV_DIR%\bin to the system PATH.

Now check that the installation works: start the contours.exe example program.

Senast uppdaterad: 2014-03-18