Zac Gross

Code & More

Setup Opencv Project With Qt Creator on Linux

| Comments

The following tutorial will show you how to setup a console project in qt creator for opencv based projects. It assumes you have already installed the opencv library.

If not installed, install qt creator

1
sudo apt-get qtcreator

Open qt creator

create a new console application project

Add following lines to .pro file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
INCLUDEPATH += /usr/local/include/opencv2/

LIBS += -L /usr/local/lib/
LIBS += -lopencv_core
LIBS += -lopencv_nonfree
LIBS += -lopencv_imgproc
LIBS += -lopencv_highgui
LIBS += -lopencv_ml
LIBS += -lopencv_video
LIBS += -lopencv_features2d
LIBS += -lopencv_calib3d
LIBS += -lopencv_objdetect
LIBS += -lopencv_contrib
LIBS += -lopencv_legacy
LIBS += -lopencv_flann
LIBS += -lboost_system
LIBS += -lboost_filesystem

By default qt creator will add some message pump related code to your main.cpp file, this can be commented out if you are just writing a console application (leaving it unmodified may prevent you from seeing output in the xterm console window)

If you are using ubuntu you will probably have to configure the x-term environment settings.

Goto: Tools -> options -> environment settings

Set the terminal field to the following:

1
/usr/bin/xterm -e

Comments