4

Since I am very UNHAPPY with Visual Studio (It's just Junk!) I am trying to use Qt Creator, which seems to be the solution for my c++ projects to get easily run in my Mac also. But I am using OpenCV. So, How do I set libraries in Qt? (include folder and maybe some libs)

I am trying with this app: http://www.qt-apps.org/content/show.php/Qt+Opencv+webcam+viewer?content=89995

But getting many errors since Qt does not know where to find the libraries, where should I enter the paths or something?

Help will be very well appreciated.

Ignacio

NG_
  • 6,895
  • 7
  • 45
  • 67
nacho4d
  • 43,720
  • 45
  • 157
  • 240

4 Answers4

5

I think I have answered 2 Qt questions that recoup what you are asking :

The first answer is about OpenCV integration in Qt: OpenCV with other GUI (like Qt or WxWidgets) on Win32 VC++

And the second about using 3rd party libraries in Qt: How do i reference the qjson.dll file from my qt project?

Community
  • 1
  • 1
Symbiosoft
  • 4,681
  • 6
  • 32
  • 46
4

I know that this is an old thread but this answer might help anyone on unix trying to link to OpenCV 2.3.1 +

It is actually quite simple with pkgconfig. All you have to do is in your qmake file *.pro add the following:

unix {
   CONFIG += link_pkgconfig
   PKGCONFIG += opencv
}

Thats it if you are on a unix based system.

0

Partial answer to myself:

See qmake project files, declaring other libraries.

But I think I will have to compile OpenCV for Linux as I don't think opencv.framework will work with LIBS.

Is there any variable like FRAMEWORKS?

Samuel Harmer
  • 4,264
  • 5
  • 33
  • 67
nacho4d
  • 43,720
  • 45
  • 157
  • 240
  • I don't know if I understand correctly... To use OpenCV in your Qt application you have to compile OpenCV once and then link to the resulting library in your .pro file. No need to rebuild it each time with your application (unless you modify OpenCV itself). – Symbiosoft Feb 09 '10 at 14:29
  • Sorry, I forgot to mention that I am trying to use Opencv.framework (for Mac OS) and since frameworks are not linked with the same flag "-l" I suppose I will have to compile opencv as linux and then use it in my project. That is why I was wondering if there is a " -framework " or equivalent I can use inside .pro file. – nacho4d Feb 11 '10 at 17:39
0

Warning, the answers above are deprecated & misleading. Just set up your project with CMake, just like opencv 2.x itself is. Then you just set CMake to add $OPENCV_LIBS as a library to link to and you're done. In qt creator, file-->open project and open the CMakeLists.txt file, presto.

Don't use qmake or pro files unless you really want a QT gui. Even then, look at the QT samples in opencv 2.2+ first, I think they use cmake to handle the qt interface.

peter karasev
  • 2,578
  • 1
  • 28
  • 38