问题
I'm completely newbie to QT and OpenCV development - Acutally C++ in general. I would like to develop one application with OpenCV and create its interface with Qt. What I'm not getting is, how do I integrate both parts?
I mean, to develop java I use only eclipse which gives me JFrame and other Classes for both GUI and App development. To work with OpenCV I added the C++ IDE; But even that QT has its IDE, May I fully work with Eclipse importing Qt Libraries to develop the GUI of my application?
回答1:
Qt and OpenCV are just C++ libraries, you can work in any C++ environment with a C++ compiler supported by them. Eclipse with a (supported) C++ compiler of your choice would be one alternative. Visual C++ if you're on Windows is another.
Qt has stand-alone tools that you can use to design the user interface in, such as Qt Designer and Qt Linguist. Qt also has an excellent C++ cross-platform development environment called Qt Creator that you may want to take a closer look at. An overview of the tools available can be found here. And just to be clear, Qt Creator is not for Qt only development, you can add any C++ library, like the OpenCV library.
回答2:
Beside Daniel excellent points, there are few things you will have to take care of, such as conversion from OpenCV Mat (or IplImage if you happen to work with old code) to Qt QImage.
There are simple examples of Qt+OpenCV integration around, such as Qt-OpenCV-multithreaded or even simpler isee (this one being my own little project).
Cheers
回答3:
If you have this kind of problem these are the steps that you must follow : I assume that you are starting from zero and you want to write code in MVS not Qt creator .
1-Adding opencv-3.2.0-vc14 into Microsoft visual_studio 2015 Enterprise :
Just see this tutorial on Youtube https://www.youtube.com/watch?v=l4372qtZ4dc
when you are done with 1 go to 2
2-download Qt from (I use 64bit 2015 version )
https://www.qt.io/download-open-source/#section-2
to add Qt add_in into the MVS 2015 see tis tutorial on Youtube :
https://www.youtube.com/watch?v=TfEttsC1vEA]
When you are done with 2 go to 3
Creat a QtApplication project from MVS2015 with default properties. When you are
done with creating on the solution Explorer window head to the Source File _
main.cpp _ right click _ properties _ C/C++ _ General _ Additional include directories and add the C:\opencv\build\include
in it. Finish!
来源:https://stackoverflow.com/questions/17907754/integration-between-opencv-and-qt