Tag Archives: Qt
Ubuntu (Unity) is moving toward Qt
After choosing Qt/QML framework as main support for its mobile operating system (smartphone/tablet), it seems that the desktop version is moving toward this line.
The next version of Unity, the hated/loved Ubuntu Desktop user interface called “Unity Next” will be realized in fact with the new framework Qt5.
Source: Phronix - Ubuntu Wiki
Software
This page collects all the code designed to control the robot and devices.
It may happen that after all the checks and tests the proposed code contains bugs (who is able to code without bugs?). If you found it, or simply want to report someone who you think improvements can be made my email is always at your disposal.
In addition to the code used on the Rover, it is available a collection of tutorials on Computer Vision and general programming.
Note: Title in “italian language” means that the article has not an english translation yet. You can read the article in your language using automatic translation tool available in article page under the title.
Microchip PIC
- Ambiente di Sviluppo SW PIC. A little tutorial about installation and configuration of the C programming environment for Microchip PIC [Old Site Version].
- Controllo Servo R/C . C code written for PIC 16f628 to control a DC Servo Motor [Old site version]
Computer Vision
- Qt Widget based on OpenGL to render OpenCV images [First Part]. first part of the tutorial about Qt Widget realization
- Qt Widget based on OpenGL to render OpenCV images [Second Part].. second part of the tutorial about Qt Widget usage.
- [Back soon] Face Recognition using OpenCV: tutorial about Face Recognition using OpenCV library.
- [Back soon] Background Subtraction: tutorial about Background Segmentation using OpenCV.
- OpenCV e il riconoscimento dei contorni. Tutorial to illustrate how it is easy to detect contours in an image using OpenCV library [Old site version]
[OpenCV Qt Tutorial] OpenGL Widget to show OpenCV images in a Qt GUI (Second Part)
After the creation of the Qt Widget to show an OpenCV image in a GUI in the first part of the tutorial, now we are going to see how to use it.
The simple application that we are going to create allows us to render the streaming video from a webcam. This is the base for each application that uses OpenCV.
This tutorial requires basic knowledge of Qt Creator and Qt. If you think that any step is not clear or sufficiently explained, please do not hesitate to contact me via email.
Let’s start by opening the application QtCreator, Qt can also be used in other work environments (Eclipse, Visual Studio, …), but honestly I prefer to use its original environment as it has been specially designed to take advantage of all the features of Qt.
Let’s create a new project “Qt Widget Project” -> “Qt GUI Application”.
Let’s copy in the project’s folder the files we created in the first part of the tutorial.
Add to the project the exisitng files “cqtopencvviewergl.h” and “cqtopencvviewergl.cpp”.
Let’s add to the GUI the widget OpenGL-OpenCV:
- open the form
- take a standard widget from “Containers” sub-list
- name the widget “openCVviewer”
- click on the widget with the right button and select “Promote to”
- nclick “Add” and insert “CQtOpenCVViewerGl” in “Promoted Class Name”
- click on the Form with the right button, select “Layout” and then “Layout in a Grid” to expand the widget on the whole available area
The base of the interface is ready. Now we need to configure the application so that it can use OpenCV:
- Let’s open the “pro” file and add:INCLUDEPATH += your openCV path
(for Linux: INCLUDEPATH += /usr/local/opencv2/)
- aggiungiamo ancheLIBS += -lopencv_core -lopencv_highgui
Now that the application is designed to using OpenCV we can enter the code to display the images from the webcam.
Still open the form and insert an item “Start” int themenu:
- select the menu bar where the label “Type here” and insert “Camera”
- select the item “Camera” and in the submenu “Type here” type “Start”
In the “Action Editor” menu click with the right mouse button on “actionStart” and select “Go to slot…”->”triggered()”.
QtCreator in this way automatically creates the function that will be called when the user selects “Camera”->”Start”.
Our function is very simple:
void QtGLWebcamDemo::on_actionStart_triggered()
{
if( !mCapture.isOpened() )
if( !mCapture.open( 0 ) )
return;
startTimer(50);
}
mCapture is a private variable of our GUI:
cv::VideoCapture mCapture;
Remember also that in order to use VideoCapture we must include the OpenCV module “HighGUI” in our application:
#include
The application must handle the timer that we just created so that every 50 msec it asks a new webcam image and sends it to our widget opengl.
Add to our main class the handling of the Timer:
protected:
void timerEvent(QTimerEvent *event);
That will contain the following simple code:
void QtGLWebcamDemo::timerEvent(QTimerEvent *event)
{
cv::Mat image;
mCapture >> image;
// Do what you want with the image <img class="wp-smiley" alt=":-)" src="/web/20120417211944im_/http://www.robot-home.it/blog/wp-includes/images/smilies/icon_smile.gif" />
// Show the image
ui->openCVviewer->showImage( image );
}
We arrived at the end. The simple application to display the video stream from a webcam using Qt, OpenCV and OpenGL is ready, you just have to compile and try it.
If you want to download the project files for this tutorial, follow this link .
Have fun










