0% found this document useful (0 votes)
281 views5 pages

OpenCV With QT

The document provides a 10 step process for installing and configuring OpenCV and QT to work together in Windows: 1) Install QT SDK and extract OpenCV files 2) Install CMake 3) Use CMake to configure OpenCV to build with MinGW and QT support 4) Add MinGW bin path to system variables to resolve missing DLL errors 5) Generate and build OpenCV files with MinGW 6) Test installation by running a sample QT project configured to use OpenCV
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
281 views5 pages

OpenCV With QT

The document provides a 10 step process for installing and configuring OpenCV and QT to work together in Windows: 1) Install QT SDK and extract OpenCV files 2) Install CMake 3) Use CMake to configure OpenCV to build with MinGW and QT support 4) Add MinGW bin path to system variables to resolve missing DLL errors 5) Generate and build OpenCV files with MinGW 6) Test installation by running a sample QT project configured to use OpenCV
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

OpenCV with QT Installation,

configuration, problems and solutions


OpenCV ?

If you dont know yet, OpenCV is a free library for image processing and computer vision
applications. You can find more info from their web site.

So why QT ?

OpenCV can be used mainly in programs written in C and C++ (not only that, there are so many
wrappers which enables you to work with OpenCV in other languages too). So talking about C+
+ why not using Visual C++ ?? Of course you can easily design GUIs. But why QT ?

QT is an C++ IDE which can be used to create gui applications easily. Find more info here.

The main advantage in using QT is that we can easily integrate the GUIs of OpenCV inside the
GUIs created with QT.( Correct me if Im wrong) What it means is that, It is hard to insert a
video window inside a form created with C#. If you are using Visual Studio the window will
open seperately to display the video. Think you got the point. Do some research, youll find the
importance.

So lets go to the topic..

Installing and configuring QT to work with OpenCV in Windows

Step 1:

FIrst we need to download and install the complete QT SDK. Download it here and get it
installed. ( I have installed Qt SDK version 1.1.4 which includes the QT Creator IDE version
2.3 into the folder C:\QtSDK)

Step 2:

Install CMake. Download it here. (I used CMake 2.8.2)

Step 3:

Download [Link] and extract it to a folder (In my case it is C:\OpenCV2.2 ). Im


using the version 2.2 here. Newer versions also can be used in the same way i describe here with
minor changes.

Step 4:

Now we need to comiple the OpenCV libraries. Run the CMake GUI.

CMake

Now give the source folder ( Mine is C:\OpenCV2.2) and create a folder for the binaries to be
build (my case it is C:\OpenCV2.2MinGw ) and give the path to the Where to build binaries
box.

Step 5:
Now press configure. Select the generator as MinGW Makefiles.

And select Use default native compilers and press finish.

Step 6:

Wait some time and youll get a configuration screen.

Set DEBUG;RELEASE for CMAKE_BUILD_TYPE.

If you like you can check the box for BUILD_EXAMPLES, so you can play with the examples

Check WITH_QT.

Now press configure again.

Step 7:

Now youll see a similar window to the last one and it asks for the path of [Link]. You need
to puth the path to the [Link] here.

For me it is

1 C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin\[Link]

Press configure again.

Step 8:

Now press Generate, so it will try to generate the makefiles.

Missing [Link] problem

Most probably youll get a message saying that missing [Link] is missing. Solution is
simple just add the bin folder of MinGW to the System Path variable

( My Computer -> View System Information -> Advanced -> Environment Variables -> System
Variables -> Path -. Edit (or New) )

In my case this path is

1 C:\QtSDK\mingw\bin
.Now you are ready to proceed. Press generate button of the CMake window again.

Step 9:

Now youll get the required files in the folder which you gave as build folder above. Now we
need to compile these files with MinGW.

Open Command Prompt and change your directory to the build folder

1 cd C:\OpenCV2.2MinGw

Now give the command

1 mingw32-make

Have a nap because it takes some time for this process to complete

Step 10:

After completion of step 9 give the command

1 mingw32-make install

You are DONE!

Playing with QT : Check whether everything is working fine..

Download this. Double Click and open the [Link] file. It will be opened with QT Creator.

In the [Link] file change the paths INCLUDEPATH and LIBS, if you used paths other than
the ones I used.

Now run the project. Enjoy using QT

Good books I have come across :

For OpenCV with QT : OpenCV 2 Computer Vision Application Programming Cookbook


book (Packt Publishers) (This is where I took the above simple example)
For learning OpenCV : Learning OpenCV OReilly Media

You might also like