newDelete
newDelete

Reputation: 385

Integrating QT and OpenCV?

I tried integrating QT and OpenCV with the following .pro but I still get errors about linking.

######################################################################
# Automatically generated by qmake (2.01a) Wed Apr 6 17:34:22 2011
######################################################################

TEMPLATE = app
TARGET = 
DEPENDPATH += .
INCLUDEPATH += .
QT+=opengl
# Input
HEADERS += glwidget.h mainwindow.h ui_info.h ui_information.h
FORMS += mainwindow.ui
SOURCES += glwidget.cpp main.cpp mainwindow.cpp
RESOURCES += res.qrc

INCLUDEPATH += /usr/local/include/opencv 
LIBS += /Library/Frameworks/OpenCV/lib

any idea what I can do?

Upvotes: 0

Views: 1060

Answers (4)

IntenseCorona
IntenseCorona

Reputation: 49

The EASIEST and most SURE way to link an external library like OpenCV is to use the "Add Library" wizard inside Qt Creator.

The steps listed below are found in the Qt5 documentation: [http://doc.qt.io/qtcreator/creator-project-qmake-libraries.html][1] under the "To Add Library" section.

  1. Right click on the project file located in the 'project pane' on the left side of the creator... and select "Add Library..."
  2. Follow the instructions of the wizard

Let me add some specificity from here...

  1. Select "External Library"
  2. For the "Library File" navigate to your opencv_worldXXX.lib file (or opencv_worldXXXd.lib file, you will notice that by specifying only one or the other the wizard has a checkbox which includes the other automatically) [ex. ...\opencv\build\x64\vc12\lib\opncv_world.lib]
  3. For the "Include Folder" navigate to the "include" folder within the build. [ex. ...\opencv\build\include]
  4. Select your operating system, dynamic/static library (whichever is appropriate)
  5. Hit NEXT, CLEAN UP, and RUN!

Upvotes: 0

newDelete
newDelete

Reputation: 385

I Finally found a solution. I Have moved my blog I will post again soon. If you need it just msg me and I will send to you!

Upvotes: 1

Muhammad Anjum Kaiser
Muhammad Anjum Kaiser

Reputation: 4077

you are missing library name in this configuration, specify the libs names as following:

LIBS += -L/usr/local/lib -lcv -lhighgui

Library names can change with versions of OpenCV, so you have to look at OpenCV documentation. A simpler method will be to use pkg-config by replacing INCLUDEPATH and LIBS with the following in your project .pro file:

CONFIG += link_pkgconfig
PKGCONFIG += opencv

Upvotes: 1

user152508
user152508

Reputation: 3131

try to add the filename of the lib to the path. LIBS += /Library/Frameworks/OpenCV/lib/opencv.lib

Upvotes: 0

Related Questions