This figure explains the new functionalities implemented with Qt GUI. As we can see, the new GUI provides a statusbar, a toolbar, and a control panel. The control panel can have trackbars and buttonbars attached to it.
*
To attach a trackbar, the window
_
name parameter must be NULL.
*
To attach a buttonbar, a button must be created.
If the last bar attached to the control panel is a buttonbar, the new button is added on the right of the last button.
If the last bar attached to the control panel is a trackbar, or the control panel is empty, a new buttonbar is created. Then a new button is attached to it.
The following code is an example used to generate the figure.
..cfunction:: CvFont cvFontQt(const char* nameFont, int pointSize = -1, CvScalar color = cvScalarAll(0), int weight = CV_FONT_NORMAL, int style = CV_STYLE_NORMAL, int spacing = 0)
Create the font to be used to draw text on an image (with ).
:param nameFont:Name of the font. The name should match the name of a system font (such as ``Times''). If the font is not found, a default one will be used.
:param pointSize:Size of the font. If not specified, equal zero or negative, the point size of the font is set to a system-dependent default value. Generally, this is 12 points.
:param color:Color of the font in BGRA -- A = 255 is fully transparent. Use the macro CV _ RGB for simplicity.
:param weight:The operation flags:
***CV_FONT_LIGHT** Weight of 25
***CV_FONT_NORMAL** Weight of 50
***CV_FONT_DEMIBOLD** Weight of 63
***CV_FONT_BOLD** Weight of 75
***CV_FONT_BLACK** Weight of 87
You can also specify a positive integer for more control.
:param style:The operation flags:
***CV_STYLE_NORMAL** Font is normal
***CV_STYLE_ITALIC** Font is in italic
***CV_STYLE_OBLIQUE** Font is oblique
:param spacing:Spacing between characters. Can be negative or positive
The function
``cvFontQt``
creates a CvFont object to be used with
:ref:`addText`
. This CvFont is not compatible with cvPutText.
A basic usage of this function is:
::
CvFont font = cvFontQt(''Times'');
cvAddText( img1, ``Hello World !'', cvPoint(50,50), font);
..cfunction:: void cvDisplayOverlay(const char* name, const char* text, int delay)
Display text on the window's image as an overlay for delay milliseconds. This is not editing the image's data. The text is display on the top of the image.
:param name:Name of the window
:param text:Overlay text to write on the window's image
:param delay:Delay to display the overlay text. If this function is called before the previous overlay text time out, the timer is restarted and the text updated. . If this value is zero, the text never disapers.
The function
``cvDisplayOverlay``
aims at displaying useful information/tips on the window for a certain amount of time
*delay*
. This information is display on the top of the window.
..cfunction:: void cvDisplayStatusBar(const char* name, const char* text, int delayms)
Display text on the window's statusbar as for delay milliseconds.
:param name:Name of the window
:param text:Text to write on the window's statusbar
:param delay:Delay to display the text. If this function is called before the previous text time out, the timer is restarted and the text updated. If this value is zero, the text never disapers.
The function
``cvDisplayOverlay``
aims at displaying useful information/tips on the window for a certain amount of time
*delay*
. This information is displayed on the window's statubar (the window must be created with
..cfunction:: cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0)
Create a callback function called to draw OpenGL on top the the image display by windowname.
:param button_name:Name of the button *( if NULL, the name will be "button <number of boutton>")*
:param on_change:
Pointer to the function to be called every time the button changed its state.
This function should be prototyped as ``void Foo(int state,*void);`` . *state* is the current state of the button. It could be -1 for a push button, 0 or 1 for a check/radio box button.
:param userdata:pointer passed to the callback function. *(Optional)*
The
``button_type``
parameter can be :
*(Optional -- Will be a push button by default.)
***CV_PUSH_BUTTON** The button will be a push button.
***CV_CHECKBOX** The button will be a checkbox button.
***CV_RADIOBOX** The button will be a radiobox button. The radiobox on the same buttonbar (same line) are exclusive; one on can be select at the time.
*
***initial_button_state** Default state of the button. Use for checkbox and radiobox, its value could be 0 or 1. *(Optional)*
The function
``cvCreateButton``
attach button to the control panel. Each button is added to a buttonbar on the right of the last button.
A new buttonbar is create if nothing was attached to the control panel before, or if the last element attached to the control panel was a trackbar.
Here are various example of
``cvCreateButton``
function call:
::
cvCreateButton(NULL,callbackButton);//create a push button "button 0", that will call callbackButton.