PDA

View Full Version : Qt Gui with OpenCV video and buttons



marcusbarnet
19th May 2011, 15:18
Hi to all,

I'd like to start learning Qt libraries, i've installed them on my Ubuntu 10.10 and I've read some code examples on this forum, in particular a topic about opencv included in a QT application.
Before to start to code, i'd like to ask you if it is possible to realize a GUI which has a window divided in two parts: an upper part where i play a video or i display some images captured with OpenCV and a lower part (always in the same window) which has some buttons in order to control the application behavior.

Do you think it's possible to do this?

At the moment, i have an opencv application which display a video in a window and takes control in a console application and i'd like to have just a window with some buttons.

If it is possible, is there any example which i can see?

Thanks to all.

high_flyer
19th May 2011, 16:19
Before to start to code, i'd like to ask you if it is possible to realize a GUI which has a window divided in two parts: an upper part where i play a video or i display some images captured with OpenCV and a lower part (always in the same window) which has some buttons in order to control the application behavior.

Do you think it's possible to do this?
Yes it is very much possible.


If it is possible, is there any example which i can see?
Example for what?
For creating the GUI it self?
This is what Qt is for - its a GUI tool kit.
Just use the widgets you need.
For displaying image data obtained by external sources such as opencv search the forum, or ask any specific question when you encounter problems.

marcusbarnet
19th May 2011, 21:11
Thanks a lot for your answer.
I'm pelased to know that what i want to do is possible with Qt.

For my question about the example, i mean if it is possible to see an example with a widget which have an area where you can see the images and another area where there are buttons.

I try to explain better what i'd like to do:

I have two opencv applications:
- application A: where i track an object and each time i save a frame in an image file and i control the application behavior with some commands which i write in the shell
- application B: where i have a loop which reads every time the image file and display it

I want to integrate application B in application A in order to show a window like the one which i've included in this post in order to have a loop which shows image in the first area and to use buttons in order to give commands which at the moment i write in the shell.

Do you think it's possible to display the frames in an area with Qt?

At the moment, my application B is very simple:

while(1)
{
Mat img=imread("result.jpg",1);
if(!img.empty())
imshow("HOG",img);
if(waitKey(200)==27) break;
}
I like to show frames in a Qt window (I'm using Ubuntu).

There is some example based on a template similar to what i'd like to do?
(like the jpg image which i've included in this post)

high_flyer
20th May 2011, 08:48
For my question about the example, i mean if it is possible to see an example with a widget which have an area where you can see the images and another area where there are buttons.
This is a trivial case of a GUI.
Its where you have a bunch of widgets on a form.
If these widgest are used for showing video or for something else is relevant for the example.
Just open designer, drag and drop the widgets you need, and you have your form done in 5 minutes.
You can use a QWidget or a QLabel as your video frame widget.
Its too trivial to have an example for.
Here you have an example how to make GUI using designer:
http://doc.qt.nokia.com/latest/designer-quick-start.html

I want to integrate application B in application A
Build application B as a library, and link to it from application A.