Using Qt for OpenCV developments
Qt is a cross-platform IDE for C++ applications developed as an open source project. It is offered under the GNU Lesser General Public License (LGPL) open source license as well as under a commercial (and paid) license for the development of proprietary projects. It is composed of two separate elements—a cross-platform IDE called Qt Creator, and a set of Qt class libraries and development tools. Using Qt to develop C++ applications has the following benefits:
- It is an open source initiative, developed by the Qt community, that gives you access to the source code of the different Qt components
- It is a cross-platform IDE, meaning that you can develop applications that can run on different operating systems, such as Windows, Linux, macOS, and so on
- It includes a complete and cross-platform GUI library that follows an effective object-oriented and event-driven model
- Qt also includes several cross-platform libraries that help you to develop multimedia, graphics, databases, multithreading, web applications, and many other interesting building blocks useful for designing advanced applications
You can download Qt from https://www.qt.io/developers/. When you install it, you will be offered the choice of different compilers. Under Windows, MinGW is an excellent alternative to the Visual Studio compilers.
Compiling the OpenCV library with Qt is particularly easy because it can read CMake files. Once OpenCV and CMake have been installed, simply select Open File or Project... from the Qt menu, and open the CMakeLists.txt file that you will find under the sources directory of OpenCV. This will create an OpenCV project that you will have built by clicking on Build Project in the Qt menu:
You might get a few warnings, but these can be overlooked without consequences.