Classes | |
struct | cvui_block_t |
struct | cvui_context_t |
struct | cvui_input_t |
struct | cvui_label_t |
struct | cvui_mouse_btn_t |
struct | cvui_mouse_t |
Functions | |
void | beginColumn (cv::Mat &theWhere, int theX, int theY, int theWidth=-1, int theHeight=-1, int thePadding=0) |
Start a new column. More... | |
void | beginColumn (int theWidth=-1, int theHeight=-1, int thePadding=0) |
Start a column. More... | |
void | beginRow (cv::Mat &theWhere, int theX, int theY, int theWidth=-1, int theHeight=-1, int thePadding=0) |
Start a new row. More... | |
void | beginRow (int theWidth=-1, int theHeight=-1, int thePadding=0) |
Start a row. More... | |
bool | button (const cv::String &theLabel) |
Display a button within a begin*() and end*() block. More... | |
bool | button (cv::Mat &theIdle, cv::Mat &theOver, cv::Mat &theDown) |
Display a button whose graphics are images (cv::Mat). More... | |
bool | button (cv::Mat &theWhere, int theX, int theY, const cv::String &theLabel) |
Display a button. More... | |
bool | button (cv::Mat &theWhere, int theX, int theY, cv::Mat &theIdle, cv::Mat &theOver, cv::Mat &theDown) |
Display a button whose graphics are images (cv::Mat). More... | |
bool | button (cv::Mat &theWhere, int theX, int theY, int theWidth, int theHeight, const cv::String &theLabel) |
Display a button. More... | |
bool | button (int theWidth, int theHeight, const cv::String &theLabel) |
Display a button within a begin*() and end*() block. More... | |
bool | checkbox (const cv::String &theLabel, bool *theState, unsigned int theColor=0xCECECE) |
Display a checkbox within a begin*() and end*() block. More... | |
bool | checkbox (cv::Mat &theWhere, int theX, int theY, const cv::String &theLabel, bool *theState, unsigned int theColor=0xCECECE) |
Display a checkbox. More... | |
void | context (const cv::String &theWindowName) |
Inform cvui that all subsequent component calls belong to a window in particular. More... | |
double | counter (cv::Mat &theWhere, int theX, int theY, double *theValue, double theStep=0.5, const char *theFormat="%.2f") |
Display a counter for float values that the user can increase/descrease by clicking the up and down arrows. More... | |
int | counter (cv::Mat &theWhere, int theX, int theY, int *theValue, int theStep=1, const char *theFormat="%d") |
Display a counter for integer values that the user can increase/descrease by clicking the up and down arrows. More... | |
double | counter (double *theValue, double theStep=0.5, const char *theFormat="%.2f") |
Display a counter for float values that the user can increase/descrease by clicking the up and down arrows. More... | |
int | counter (int *theValue, int theStep=1, const char *theFormat="%d") |
Display a counter for integer values that the user can increase/descrease by clicking the up and down arrows. More... | |
void | endColumn () |
End a column. More... | |
void | endRow () |
Ends a row. More... | |
void | handleMouse (int theEvent, int theX, int theY, int theFlags, void *theData) |
bool | headless () |
Inform if cvui is running in headless more. More... | |
void | headless (bool theValue) |
Enable/disable headless more. More... | |
int | iarea (int theX, int theY, int theWidth, int theHeight) |
Create an interaction area that reports activity with the mouse cursor. More... | |
void | image (cv::Mat &theImage) |
Display an image (cv::Mat) within a begin*() and end*() block. More... | |
void | image (cv::Mat &theWhere, int theX, int theY, cv::Mat &theImage) |
Display an image (cv::Mat). More... | |
void | imshow (const cv::String &theWindowName, cv::InputArray theFrame) |
Display an image in the specified window and update the internal structures of cvui. More... | |
void | init (const cv::String &theWindowName, int theDelayWaitKey=-1, bool theCreateNamedWindow=true, bool theHeadlessMode=false) |
Initializes cvui. More... | |
void | init (const cv::String theWindowNames[], size_t theHowManyWindows, int theDelayWaitKey=-1, bool theCreateNamedWindows=true, bool theHeadlessMode=false) |
Initialize cvui using a list of names of windows where components will be added. More... | |
int | input (cv::Mat &theWhere, int theX, int theY, int theWidth, const cv::String theName, cv::String &theValue, double theFontScale=0.5) |
Display an inputtext. More... | |
int | lastKeyPressed () |
Return the last key that was pressed. More... | |
bool | mouse (const cv::String &theWindowName, int theButton, int theQuery) |
Query the mouse for events in a particular button in a particular window. More... | |
bool | mouse (const cv::String &theWindowName, int theQuery) |
Query the mouse for events in a particular window. More... | |
cv::Point | mouse (const cv::String &theWindowName="") |
Return the last position of the mouse. More... | |
bool | mouse (int theButton, int theQuery) |
Query the mouse for events in a particular button. More... | |
bool | mouse (int theQuery) |
Query the mouse for events, e.g. More... | |
void | printf (const char *theFmt,...) |
Display a piece of text that can be formated using stdio's printf() style. More... | |
void | printf (cv::Mat &theWhere, int theX, int theY, const char *theFmt,...) |
Display a piece of text that can be formated using stdio's printf() style. More... | |
void | printf (cv::Mat &theWhere, int theX, int theY, double theFontScale, unsigned int theColor, const char *theFmt,...) |
Display a piece of text that can be formated using stdio's printf() style. More... | |
void | printf (double theFontScale, unsigned int theColor, const char *theFmt,...) |
Display a piece of text within a begin*() and end*() block. More... | |
void | rect (cv::Mat &theWhere, int theX, int theY, int theWidth, int theHeight, unsigned int theBorderColor, unsigned int theFillingColor=0xff000000) |
Display a filled rectangle. More... | |
void | rect (int theWidth, int theHeight, unsigned int theBorderColor, unsigned int theFillingColor=0xff000000) |
Display a rectangle within a begin*() and end*() block. More... | |
void | space (int theValue=5) |
Add an arbitrary amount of space between components within a begin*() and end*() block. More... | |
void | sparkline (cv::Mat &theWhere, std::vector< double > &theValues, int theX, int theY, int theWidth, int theHeight, unsigned int theColor=0x00FF00) |
Display the values of a vector as a sparkline. More... | |
void | sparkline (std::vector< double > &theValues, int theWidth, int theHeight, unsigned int theColor=0x00FF00) |
Display the values of a vector as a sparkline within a begin*() and end*() block. More... | |
void | text (const cv::String &theText, double theFontScale=0.4, unsigned int theColor=0xCECECE) |
Display a piece of text within a begin*() and end*() block. More... | |
void | text (cv::Mat &theWhere, int theX, int theY, const cv::String &theText, double theFontScale=0.4, unsigned int theColor=0xCECECE) |
Display a piece of text. More... | |
template<typename num_type > | |
bool | trackbar (cv::Mat &theWhere, int theX, int theY, int theWidth, num_type *theValue, num_type theMin, num_type theMax, int theSegments, const char *theLabelFormat, unsigned int theOptions, num_type theDiscreteStep) |
template<typename T > | |
bool | trackbar (cv::Mat &theWhere, int theX, int theY, int theWidth, T *theValue, T theMin, T theMax, int theSegments=1, const char *theLabelFormat="%.1Lf", unsigned int theOptions=0, T theDiscreteStep=1) |
Display a trackbar for numeric values that the user can increase/decrease by clicking and/or dragging the marker right or left. More... | |
template<typename num_type > | |
bool | trackbar (int theWidth, num_type *theValue, num_type theMin, num_type theMax, int theSegments, const char *theLabelFormat, unsigned int theOptions, num_type theDiscreteStep) |
template<typename T > | |
bool | trackbar (int theWidth, T *theValue, T theMin, T theMax, int theSegments=1, const char *theLabelFormat="%.1Lf", unsigned int theOptions=0, T theDiscreteStep=1) |
Display a trackbar for numeric values that the user can increase/decrease by clicking and/or dragging the marker right or left. More... | |
void | update (const cv::String &theWindowName="") |
Update the library internal things. More... | |
void | watch (const cv::String &theWindowName, bool theCreateNamedWindow=true) |
Track UI interactions of a particular window. More... | |
void | window (cv::Mat &theWhere, int theX, int theY, int theWidth, int theHeight, const cv::String &theTitle) |
Display a window (a block with a title and a body). More... | |
void | window (int theWidth, int theHeight, const cv::String &theTitle) |
Display a window (a block with a title and a body) within a begin*() and end*() block. More... | |
Variables | |
const int | CLICK = 3 |
const int | COLUMN = 1 |
const int | DOWN = 2 |
const unsigned int | INTPUT_CURSOR_BLINK_SLOWNESS = 10 |
const int | IS_DOWN = 7 |
const unsigned int | KEY_ARROW_DOWN = 2621440 |
const unsigned int | KEY_ARROW_LEFT = 2424832 |
const unsigned int | KEY_ARROW_RIGHT = 2555904 |
const unsigned int | KEY_ARROW_UP = 2490368 |
const unsigned int | KEY_BACKSPACE = 8 |
const unsigned int | KEY_DELETE = 3014656 |
const unsigned int | KEY_END = 2293760 |
const unsigned int | KEY_ENTER = 13 |
const unsigned int | KEY_HOME = 2359296 |
const unsigned int | KEY_NONE = -1 |
const unsigned int | KEY_TAB = 9 |
const int | LEFT_BUTTON = 0 |
const int | MIDDLE_BUTTON = 1 |
const int | OUT = 5 |
const int | OVER = 4 |
const int | RIGHT_BUTTON = 2 |
const int | ROW = 0 |
const unsigned int | TRACKBAR_DISCRETE = 4 |
const unsigned int | TRACKBAR_HIDE_LABELS = 32 |
const unsigned int | TRACKBAR_HIDE_MIN_MAX_LABELS = 8 |
const unsigned int | TRACKBAR_HIDE_SEGMENT_LABELS = 1 |
const unsigned int | TRACKBAR_HIDE_STEP_SCALE = 2 |
const unsigned int | TRACKBAR_HIDE_VALUE_LABEL = 16 |
const int | UP = 6 |
void cvui::beginColumn | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
int | theWidth = -1 , |
||
int | theHeight = -1 , |
||
int | thePadding = 0 |
||
) |
Start a new column.
One of the most annoying tasks when building UI is to calculate where each component should be placed on the screen. cvui has a set of methods that abstract the process of positioning components, so you don't have to think about assigning a X and Y coordinate. Instead you just add components and cvui will place them as you go.
You use beginColumn()
to start a group of elements. After beginColumn()
has been called, all subsequent component calls don't have to specify the frame where the component should be rendered nor its position. The position of the component will be automatically calculated by cvui based on the components within the group. All components are placed below each other, from the top of the screen towards the bottom.
E.g.
Rows and columns can be nested, so you can create columns/rows within columns/rows as much as you want. It's important to notice that any component within beginColumn()
and endColumn()
do not specify the position where the component is rendered, which is also true for beginColumn()
. As a consequence, be sure you are calling beginColumn(width, height)
when the call is nested instead of beginColumn(x, y, width, height)
, otherwise cvui will throw an error.
E.g.
Don't forget to call endColumn()
to finish the column, otherwise cvui will throw an error.
theWhere | image/frame where the components within this block should be rendered. |
theX | position X where the row should be placed. |
theY | position Y where the row should be placed. |
theWidth | width of the column. If a negative value is specified, the width of the column will be automatically calculated based on the content of the block. |
theHeight | height of the column. If a negative value is specified, the height of the column will be automatically calculated based on the content of the block. |
thePadding | space, in pixels, among the components of the block. |
Referenced by EnhancedWindow::begin(), and main().
void cvui::beginColumn | ( | int | theWidth = -1 , |
int | theHeight = -1 , |
||
int | thePadding = 0 |
||
) |
Start a column.
This function behaves in the same way as beginColumn(frame, x, y, width, height)
, however it is suposed to be used within begin*()/end*()
blocks since they require components not to inform frame nor x,y coordinates.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theWidth | width of the column. If a negative value is specified, the width of the column will be automatically calculated based on the content of the block. |
theHeight | height of the column. If a negative value is specified, the height of the column will be automatically calculated based on the content of the block. |
thePadding | space, in pixels, among the components of the block. |
Referenced by EnhancedWindow.EnhancedWindow::begin(), multiple-windows-complex::main(), nested-rows-columns::main(), on-image::main(), trackbar-complex::main(), row-column::main(), and multiple-windows-complex-dynamic::main().
void cvui::beginRow | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
int | theWidth = -1 , |
||
int | theHeight = -1 , |
||
int | thePadding = 0 |
||
) |
Start a new row.
One of the most annoying tasks when building UI is to calculate where each component should be placed on the screen. cvui has a set of methods that abstract the process of positioning components, so you don't have to think about assigning a X and Y coordinate. Instead you just add components and cvui will place them as you go.
You use beginRow()
to start a group of elements. After beginRow()
has been called, all subsequent component calls don't have to specify the frame where the component should be rendered nor its position. The position of the component will be automatically calculated by cvui based on the components within the group. All components are placed side by side, from left to right.
E.g.
Rows and columns can be nested, so you can create columns/rows within columns/rows as much as you want. It's important to notice that any component within beginRow()
and endRow()
do not specify the position where the component is rendered, which is also true for beginRow()
. As a consequence, be sure you are calling beginRow(width, height)
when the call is nested instead of beginRow(x, y, width, height)
, otherwise cvui will throw an error.
E.g.
Don't forget to call endRow()
to finish the row, otherwise cvui will throw an error.
theWhere | image/frame where the components within this block should be rendered. |
theX | position X where the row should be placed. |
theY | position Y where the row should be placed. |
theWidth | width of the row. If a negative value is specified, the width of the row will be automatically calculated based on the content of the block. |
theHeight | height of the row. If a negative value is specified, the height of the row will be automatically calculated based on the content of the block. |
thePadding | space, in pixels, among the components of the block. |
Referenced by EnhancedWindow::begin(), and main().
void cvui::beginRow | ( | int | theWidth = -1 , |
int | theHeight = -1 , |
||
int | thePadding = 0 |
||
) |
Start a row.
This function behaves in the same way as beginRow(frame, x, y, width, height)
, however it is suposed to be used within begin*()/end*()
blocks since they require components not to inform frame nor x,y coordinates.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theWidth | width of the row. If a negative value is specified, the width of the row will be automatically calculated based on the content of the block. |
theHeight | height of the row. If a negative value is specified, the height of the row will be automatically calculated based on the content of the block. |
thePadding | space, in pixels, among the components of the block. |
Referenced by EnhancedWindow.EnhancedWindow::begin(), multiple-windows-complex::main(), nested-rows-columns::main(), trackbar-sparkline::main(), and row-column::main().
bool cvui::button | ( | const cv::String & | theLabel | ) |
Display a button within a begin*()
and end*()
block.
The size of the button will be automatically adjusted to properly house the label content.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theLabel | text displayed inside the button. You can set shortcuts by pre-pending them with "&" |
true
everytime the user clicks the button.bool cvui::button | ( | cv::Mat & | theIdle, |
cv::Mat & | theOver, | ||
cv::Mat & | theDown | ||
) |
Display a button whose graphics are images (cv::Mat).
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
The button accepts three images to describe its states, which are idle (no mouse interaction), over (mouse is over the button) and down (mouse clicked the button). The button size will be defined by the width and height of the images.
theIdle | image that will be rendered when the button is not interacting with the mouse cursor. |
theOver | image that will be rendered when the mouse cursor is over the button. |
theDown | image that will be rendered when the mouse cursor clicked the button (or is clicking). |
true
everytime the user clicks the button.Referenced by EnhancedWindow.EnhancedWindow::begin(), multiple-windows::compact(), input-change-counter::main(), input-react-key::main(), input-sizes::main(), image-button::main(), main-app::main(), input-detect-key::main(), input-multiple::main(), hello-world::main(), input::main(), multiple-windows-complex::main(), nested-rows-columns::main(), button-shortcut::main(), trackbar-complex::main(), on-image::main(), trackbar-sparkline::main(), row-column::main(), multiple-windows-complex-dynamic::main(), and multiple-windows::window().
bool cvui::button | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
const cv::String & | theLabel | ||
) |
Display a button.
The size of the button will be automatically adjusted to properly house the label content.
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theLabel | text displayed inside the button. |
true
everytime the user clicks the button. Referenced by EnhancedWindow::begin(), compact(), main(), and window().
bool cvui::button | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
cv::Mat & | theIdle, | ||
cv::Mat & | theOver, | ||
cv::Mat & | theDown | ||
) |
Display a button whose graphics are images (cv::Mat).
The button accepts three images to describe its states, which are idle (no mouse interaction), over (mouse is over the button) and down (mouse clicked the button). The button size will be defined by the width and height of the images.
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theIdle | an image that will be rendered when the button is not interacting with the mouse cursor. |
theOver | an image that will be rendered when the mouse cursor is over the button. |
theDown | an image that will be rendered when the mouse cursor clicked the button (or is clicking). |
true
everytime the user clicks the button.bool cvui::button | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
int | theWidth, | ||
int | theHeight, | ||
const cv::String & | theLabel | ||
) |
Display a button.
The button size will be defined by the width and height parameters, no matter the content of the label.
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theWidth | width of the button. |
theHeight | height of the button. |
theLabel | text displayed inside the button. |
true
everytime the user clicks the button. bool cvui::button | ( | int | theWidth, |
int | theHeight, | ||
const cv::String & | theLabel | ||
) |
Display a button within a begin*()
and end*()
block.
The button size will be defined by the width and height parameters, no matter the content of the label.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theWidth | width of the button. |
theHeight | height of the button. |
theLabel | text displayed inside the button. You can set shortcuts by pre-pending them with "&" |
true
everytime the user clicks the button.bool cvui::checkbox | ( | const cv::String & | theLabel, |
bool * | theState, | ||
unsigned int | theColor = 0xCECECE |
||
) |
Display a checkbox within a begin*()
and end*()
block.
You can use the state parameter to monitor if the checkbox is checked or not.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theLabel | text displayed besides the clickable checkbox square. |
theState | describes the current state of the checkbox: true means the checkbox is checked. |
theColor | color of the label in the format 0xRRGGBB , e.g. 0xff0000 for red. |
true
if it is checked.Referenced by headless::main(), main-app::main(), canny::main(), multiple-windows-complex::main(), ui-enhanced-canny::main(), row-column::main(), and Class1.Class1::renderInfo().
bool cvui::checkbox | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
const cv::String & | theLabel, | ||
bool * | theState, | ||
unsigned int | theColor = 0xCECECE |
||
) |
Display a checkbox.
You can use the state parameter to monitor if the checkbox is checked or not.
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theLabel | text displayed besides the clickable checkbox square. |
theState | describes the current state of the checkbox: true means the checkbox is checked. |
theColor | color of the label in the format 0xRRGGBB , e.g. 0xff0000 for red. |
true
if it is checked. Referenced by main(), and Class1::renderInfo().
void cvui::context | ( | const cv::String & | theWindowName | ) |
Inform cvui that all subsequent component calls belong to a window in particular.
When using cvui with multiple OpenCV windows, you must call cvui component calls between cvui::contex(NAME)
and cvui::update(NAME)
, where NAME
is the name of the window. That way, cvui knows which window you are using (NAME
in this case), so it can track mouse events, for instance.
E.g.
Pay attention to the pair cvui::context(NAME)
and cvui::update(NAME)
, which encloses the component calls for that window. You need such pair for each window of your application.
After calling cvui::update()
, you can show the result in a window using cv::imshow()
. If you want to save some typing, you can use cvui::imshow()
, which calls cvui::update()
for you and then shows the frame in a window.
E.g.:
In that case, you don't have to bother calling cvui::update()
yourself, since cvui::imshow()
will do it for you.
theWindowName | name of the window that will receive components from all subsequent cvui calls. |
Referenced by multiple-windows::compact(), compact(), main(), multiple-windows-complex::main(), multiple-windows-complex-mouse::main(), multiple-windows-complex-dynamic::main(), multiple-windows::window(), and window().
double cvui::counter | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
double * | theValue, | ||
double | theStep = 0.5 , |
||
const char * | theFormat = "%.2f" |
||
) |
Display a counter for float values that the user can increase/descrease by clicking the up and down arrows.
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theValue | the current value of the counter. |
theStep | the amount that should be increased/decreased when the user interacts with the counter buttons |
theFormat | how the value of the counter should be presented, as it was printed by stdio's printf() . E.g. "%f" means the value will be displayed as a regular float, "%.2f" float with two digits after the point, etc. |
int cvui::counter | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
int * | theValue, | ||
int | theStep = 1 , |
||
const char * | theFormat = "%d" |
||
) |
Display a counter for integer values that the user can increase/descrease by clicking the up and down arrows.
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theValue | the current value of the counter. |
theStep | the amount that should be increased/decreased when the user interacts with the counter buttons |
theFormat | how the value of the counter should be presented, as it was printed by stdio's printf() . E.g. "%d" means the value will be displayed as an integer, "%0d" integer with one leading zero, etc. |
Referenced by main().
double cvui::counter | ( | double * | theValue, |
double | theStep = 0.5 , |
||
const char * | theFormat = "%.2f" |
||
) |
Display a counter for float values that the user can increase/descrease by clicking the up and down arrows.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theValue | the current value of the counter. |
theStep | the amount that should be increased/decreased when the user interacts with the counter buttons. |
theFormat | how the value of the counter should be presented, as it was printed by stdio's printf() . E.g. "%d" means the value will be displayed as an integer, "%0d" integer with one leading zero, etc. |
Referenced by input-change-counter::main(), main-app::main(), multiple-windows-complex::main(), and row-column::main().
int cvui::counter | ( | int * | theValue, |
int | theStep = 1 , |
||
const char * | theFormat = "%d" |
||
) |
Display a counter for integer values that the user can increase/descrease by clicking the up and down arrows.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theValue | the current value of the counter. |
theStep | the amount that should be increased/decreased when the user interacts with the counter buttons. |
theFormat | how the value of the counter should be presented, as it was printed by stdio's printf() . E.g. "%d" means the value will be displayed as an integer, "%0d" integer with one leading zero, etc. |
void cvui::endColumn | ( | ) |
End a column.
You must call this function only if you have previously called its counter part, i.e. beginColumn()
.
Referenced by EnhancedWindow.EnhancedWindow::end(), EnhancedWindow::end(), multiple-windows-complex::main(), main(), nested-rows-columns::main(), trackbar-complex::main(), on-image::main(), row-column::main(), and multiple-windows-complex-dynamic::main().
void cvui::endRow | ( | ) |
Ends a row.
You must call this function only if you have previously called its counter part, the beginRow()
function.
Referenced by EnhancedWindow.EnhancedWindow::end(), EnhancedWindow::end(), multiple-windows-complex::main(), main(), nested-rows-columns::main(), trackbar-sparkline::main(), and row-column::main().
void cvui::handleMouse | ( | int | theEvent, |
int | theX, | ||
int | theY, | ||
int | theFlags, | ||
void * | theData | ||
) |
bool cvui::headless | ( | ) |
Inform if cvui is running in headless more.
true
if running in headless mode, or false
otherwise. void cvui::headless | ( | bool | theValue | ) |
Enable/disable headless more.
When running in headless mode, cvui will not render anything to the screen and it will not process interactions such as mouse clicks. This mode is useful to test apps in CI/CD.
theValue | true if cvui should run in headless more, false otherwise. |
int cvui::iarea | ( | int | theX, |
int | theY, | ||
int | theWidth, | ||
int | theHeight | ||
) |
Create an interaction area that reports activity with the mouse cursor.
The tracked interactions are returned by the function and they are:
OUT
when the cursor is not over the iarea. OVER
when the cursor is over the iarea. DOWN
when the cursor is pressed over the iarea, but not released yet. CLICK
when the cursor clicked (pressed and released) within the iarea.
This function creates no visual output on the screen. It is intended to be used as an auxiliary tool to create interactions.
theX | position X where the interactive area should be placed. |
theY | position Y where the interactive area should be placed. |
theWidth | width of the interactive area. |
theHeight | height of the interactive area. |
OUT
(cursor is not over the area), OVER
(cursor is over the area), DOWN
(cursor is pressed over the area, but not released yet) and CLICK
(cursor clicked, i.e. pressed and released, within the area).Referenced by interaction-area::main(), and main().
void cvui::image | ( | cv::Mat & | theImage | ) |
Display an image (cv::Mat) within a begin*()
and end*()
block.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theImage | image to be rendered in the specified destination. |
Referenced by multiple-windows-complex::main(), and row-column::main().
void cvui::image | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
cv::Mat & | theImage | ||
) |
Display an image (cv::Mat).
theWhere | image/frame where the provded image should be rendered. |
theX | position X where the image should be placed. |
theY | position Y where the image should be placed. |
theImage | image to be rendered in the specified destination. |
Referenced by main().
void cvui::imshow | ( | const cv::String & | theWindowName, |
cv::InputArray | theFrame | ||
) |
Display an image in the specified window and update the internal structures of cvui.
This function can be used as a replacement for cv::imshow()
. If you want to use cv::imshow() instead of
cvui::imshow(), you must ensure you call
cvui::update() after* all component calls and *before*
cv::imshow()`, so cvui can update its internal structures.
In general, it is easier to call cvui::imshow()
alone instead of calling ‘cvui::update()’ immediately followed by cv::imshow()
.
theWindowName | name of the window that will be shown. |
theFrame | image, i.e. cv::Mat , to be shown in the window. |
Referenced by multiple-windows::compact(), compact(), headless::main(), hello-world::main(), mouse::main(), main(), multiple-windows-complex-mouse::main(), ui-enhanced-window-component::main(), multiple-windows::window(), and window().
void cvui::init | ( | const cv::String & | theWindowName, |
int | theDelayWaitKey = -1 , |
||
bool | theCreateNamedWindow = true , |
||
bool | theHeadlessMode = false |
||
) |
Initializes cvui.
You must provide the name of the window where components will be added. It is also possible to tell cvui to handle OpenCV's event queue automatically (by informing a value greater than zero in the theDelayWaitKey
parameter of the function). In that case, cvui will automatically call cv::waitKey()
within cvui::update()
, so you don't have to worry about it. The value passed to theDelayWaitKey
will be used as the delay for cv::waitKey()
.
theWindowName | name of the window where the components will be added. |
theDelayWaitKey | delay value passed to cv::waitKey() . If a negative value is informed (default is -1 ), cvui will not automatically call cv::waitKey() within cvui::update() , which will disable keyboard shortcuts for all components. If you want to enable keyboard shortcut for components (e.g. using & in a button label), you must specify a positive value for this param. |
theCreateNamedWindow | if an OpenCV window named theWindowName should be created during the initialization. Windows are created using cv::namedWindow() . If this parameter is false , ensure you call cv::namedWindow(WINDOW_NAME) before initializing cvui, otherwise it will not be able to track UI interactions. |
theHeadlessMode | if cvui should run in headless more (no rendering or processing of interactions, useful for CI testing). |
Referenced by main().
void cvui::init | ( | const cv::String | theWindowNames[], |
size_t | theHowManyWindows, | ||
int | theDelayWaitKey = -1 , |
||
bool | theCreateNamedWindows = true , |
||
bool | theHeadlessMode = false |
||
) |
Initialize cvui using a list of names of windows where components will be added.
It is also possible to tell cvui to handle OpenCV's event queue automatically (by informing a value greater than zero in the theDelayWaitKey
parameter of the function). In that case, cvui will automatically call cv::waitKey()
within cvui::update()
, so you don't have to worry about it. The value passed to theDelayWaitKey
will be used as the delay for cv::waitKey()
.
theWindowNames | array containing the name of the windows where components will be added. Those windows will be automatically if theCreateNamedWindows is true . |
theHowManyWindows | how many window names exist in the theWindowNames array. |
theDelayWaitKey | delay value passed to cv::waitKey() . If a negative value is informed (default is -1 ), cvui will not automatically call cv::waitKey() within cvui::update() , which will disable keyboard shortcuts for all components. If you want to enable keyboard shortcut for components (e.g. using & in a button label), you must specify a positive value for this param. |
theCreateNamedWindows | if OpenCV windows named according to theWindowNames should be created during the initialization. Windows are created using cv::namedWindow() . If this parameter is false , ensure you call cv::namedWindow(WINDOW_NAME) for all windows before initializing cvui, otherwise it will not be able to track UI interactions. |
theHeadlessMode | if cvui should run in headless more (no rendering or processing of interactions, useful for CI testing). |
Referenced by input-change-counter::main(), input-detect-key::main(), input-multiple::main(), input-react-key::main(), input-sizes::main(), headless::main(), image-button::main(), main-app::main(), mouse::main(), canny::main(), hello-world::main(), mouse-complex::main(), multiple-windows-complex::main(), input::main(), interaction-area::main(), multiple-windows-complex-mouse::main(), nested-rows-columns::main(), mouse-complex-buttons::main(), multiple-files::main(), button-shortcut::main(), trackbar-sparkline::main(), trackbar::main(), on-image::main(), trackbar-complex::main(), ui-enhanced-window-component::main(), ui-enhanced-canny::main(), row-column::main(), sparkline::main(), multiple-windows-complex-dynamic::main(), complex-layout::main(), and multiple-windows::main().
int cvui::input | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
int | theWidth, | ||
const cv::String | theName, | ||
cv::String & | theValue, | ||
double | theFontScale = 0.5 |
||
) |
Display an inputtext.
theWhere | image/frame where the provided input should be rendered. |
theX | position X where the input should be placed. |
theY | position Y where the input should be placed. |
theWidth | size, in pixels, of the input. |
theName | unique name of the input. It will be used to control focus. |
theValue | content of the input. |
theFontScale | size of the text. |
Referenced by input-change-counter::main(), input-detect-key::main(), input-react-key::main(), input-sizes::main(), input-multiple::main(), input::main(), and main().
int cvui::lastKeyPressed | ( | ) |
Return the last key that was pressed.
This function will only work if a value greater than zero was passed to cvui::init()
as the delay waitkey parameter.
bool cvui::mouse | ( | const cv::String & | theWindowName, |
int | theButton, | ||
int | theQuery | ||
) |
Query the mouse for events in a particular button in a particular window.
This function behave exactly like cvui::mouse(int theButton, int theQuery)
, with the difference that queries are targeted at a particular mouse button in a particular window instead.
theWindowName | name of the window that will be queried. |
theButton | integer describing the mouse button to be queried. Possible values are cvui::LEFT_BUTTON , cvui::MIDDLE_BUTTON and cvui::LEFT_BUTTON . |
theQuery | integer describing the intended mouse query. Available queries are cvui::DOWN , cvui::UP , cvui::CLICK , and cvui::IS_DOWN . |
Referenced by EnhancedWindow.EnhancedWindow::begin(), mouse::main(), interaction-area::main(), mouse-complex::main(), multiple-windows-complex-mouse::main(), and mouse-complex-buttons::main().
bool cvui::mouse | ( | const cv::String & | theWindowName, |
int | theQuery | ||
) |
Query the mouse for events in a particular window.
This function behave exactly like cvui::mouse(int theQuery)
with the difference that queries are targeted at a particular window.
theWindowName | name of the window that will be queried. |
theQuery | integer describing the intended mouse query. Available queries are cvui::DOWN , cvui::UP , cvui::CLICK , and cvui::IS_DOWN . |
cv::Point cvui::mouse | ( | const cv::String & | theWindowName = "" | ) |
Return the last position of the mouse.
theWindowName | name of the window whose mouse cursor will be used. If nothing is informed (default), the function will return the position of the mouse cursor for the default window (the one informed in cvui::init() ). |
Referenced by EnhancedWindow::begin(), and main().
bool cvui::mouse | ( | int | theButton, |
int | theQuery | ||
) |
Query the mouse for events in a particular button.
This function behave exactly like cvui::mouse(int theQuery)
, with the difference that queries are targeted at a particular mouse button instead.
theButton | integer describing the mouse button to be queried. Possible values are cvui::LEFT_BUTTON , cvui::MIDDLE_BUTTON and cvui::LEFT_BUTTON . |
theQuery | integer describing the intended mouse query. Available queries are cvui::DOWN , cvui::UP , cvui::CLICK , and cvui::IS_DOWN . |
bool cvui::mouse | ( | int | theQuery | ) |
Query the mouse for events, e.g.
"is any button down now?". Available queries are:
cvui::DOWN
: any mouse button was pressed. cvui::mouse()
returns true
for a single frame only. cvui::UP
: any mouse button was released. cvui::mouse()
returns true
for a single frame only. cvui::CLICK
: any mouse button was clicked (went down then up, no matter the amount of frames in between). cvui::mouse()
returns true
for a single frame only. cvui::IS_DOWN
: any mouse button is currently pressed. cvui::mouse()
returns true
for as long as the button is down/pressed.
It is easier to think of this function as the answer to a questions. For instance, asking if any mouse button went down:
The window whose mouse will be queried depends on the context. If cvui::mouse(query)
is being called after cvui::context()
, the window informed in the context will be queried. If no context is available, the default window (informed in cvui::init()
) will be used.
theQuery | integer describing the intended mouse query. Available queries are cvui::DOWN , cvui::UP , cvui::CLICK , and cvui::IS_DOWN . |
void cvui::printf | ( | const char * | theFmt, |
... | |||
) |
Display a piece of text that can be formated using stdio's printf()
style.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
For instance if you want to display text mixed with numbers, you can use:
The size and color of the text will be based on cvui's default values.
theFmt | formating string as it would be supplied for stdio's printf() , e.g. "Text: %d and %f", 7, 3.1415 . |
Referenced by multiple-windows::compact(), input-change-counter::main(), input-react-key::main(), input-detect-key::main(), main-app::main(), hello-world::main(), mouse::main(), multiple-windows-complex::main(), mouse-complex::main(), interaction-area::main(), multiple-windows-complex-mouse::main(), mouse-complex-buttons::main(), on-image::main(), row-column::main(), and multiple-windows::window().
void cvui::printf | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
const char * | theFmt, | ||
... | |||
) |
Display a piece of text that can be formated using stdio's printf()
style.
For instance if you want to display text mixed with numbers, you can use:
The size and color of the text will be based on cvui's default values.
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theFmt | formating string as it would be supplied for stdio's printf() , e.g. "Text: %d and %f", 7, 3.1415 . |
void cvui::printf | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
double | theFontScale, | ||
unsigned int | theColor, | ||
const char * | theFmt, | ||
... | |||
) |
Display a piece of text that can be formated using stdio's printf()
style.
For instance if you want to display text mixed with numbers, you can use:
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theFontScale | size of the text. |
theColor | color of the text in the format 0xRRGGBB , e.g. 0xff0000 for red. |
theFmt | formating string as it would be supplied for stdio's printf() , e.g. "Text: %d and %f", 7, 3.1415 . |
void cvui::printf | ( | double | theFontScale, |
unsigned int | theColor, | ||
const char * | theFmt, | ||
... | |||
) |
Display a piece of text within a begin*()
and end*()
block.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
The text can be formated using stdio's printf()
style. For instance if you want to display text mixed with numbers, you can use:
theFontScale | size of the text. |
theColor | color of the text in the format 0xRRGGBB , e.g. 0xff0000 for red. |
theFmt | formating string as it would be supplied for stdio's printf() , e.g. "Text: %d and %f", 7, 3.1415 . |
void cvui::rect | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
int | theWidth, | ||
int | theHeight, | ||
unsigned int | theBorderColor, | ||
unsigned int | theFillingColor = 0xff000000 |
||
) |
Display a filled rectangle.
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theWidth | width of the rectangle. |
theHeight | height of the rectangle. |
theBorderColor | color of rectangle's border in the format 0xRRGGBB , e.g. 0xff0000 for red. |
theFillingColor | color of rectangle's filling in the format 0xAARRGGBB , e.g. 0x00ff0000 for red, 0xff000000 for transparent filling. |
void cvui::rect | ( | int | theWidth, |
int | theHeight, | ||
unsigned int | theBorderColor, | ||
unsigned int | theFillingColor = 0xff000000 |
||
) |
Display a rectangle within a begin*()
and end*()
block.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theWidth | width of the rectangle. |
theHeight | height of the rectangle. |
theBorderColor | color of rectangle's border in the format 0xRRGGBB , e.g. 0xff0000 for red. |
theFillingColor | color of rectangle's filling in the format 0xAARRGGBB , e.g. 0x00ff0000 for red, 0xff000000 for transparent filling. |
Referenced by complex-layout::group(), mouse::main(), mouse-complex::main(), interaction-area::main(), multiple-windows-complex::main(), mouse-complex-buttons::main(), and row-column::main().
void cvui::space | ( | int | theValue = 5 | ) |
Add an arbitrary amount of space between components within a begin*()
and end*()
block.
The function is aware of context, so if it is used within a beginColumn()
and endColumn()
block, the space will be vertical. If it is used within a beginRow()
and endRow()
block, space will be horizontal.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theValue | the amount of space to be added. |
Referenced by main(), multiple-windows-complex::main(), nested-rows-columns::main(), on-image::main(), trackbar-complex::main(), ui-enhanced-window-component::main(), ui-enhanced-canny::main(), and row-column::main().
void cvui::sparkline | ( | cv::Mat & | theWhere, |
std::vector< double > & | theValues, | ||
int | theX, | ||
int | theY, | ||
int | theWidth, | ||
int | theHeight, | ||
unsigned int | theColor = 0x00FF00 |
||
) |
Display the values of a vector as a sparkline.
theWhere | image/frame where the component should be rendered. |
theValues | a vector containing the values to be used in the sparkline. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theWidth | width of the sparkline. |
theHeight | height of the sparkline. |
theColor | color of sparkline in the format 0xRRGGBB , e.g. 0xff0000 for red. |
Referenced by main().
void cvui::sparkline | ( | std::vector< double > & | theValues, |
int | theWidth, | ||
int | theHeight, | ||
unsigned int | theColor = 0x00FF00 |
||
) |
Display the values of a vector as a sparkline within a begin*()
and end*()
block.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theValues | vector with the values that will be rendered as a sparkline. |
theWidth | width of the sparkline. |
theHeight | height of the sparkline. |
theColor | color of sparkline in the format 0xRRGGBB , e.g. 0xff0000 for red. |
Referenced by multiple-windows-complex::main(), trackbar-sparkline::main(), row-column::main(), and sparkline::main().
void cvui::text | ( | const cv::String & | theText, |
double | theFontScale = 0.4 , |
||
unsigned int | theColor = 0xCECECE |
||
) |
Display a piece of text within a begin*()
and end*()
block.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theText | text content. |
theFontScale | size of the text. |
theColor | color of the text in the format 0xRRGGBB , e.g. 0xff0000 for red. |
Referenced by complex-layout::group(), headless::main(), main-app::main(), image-button::main(), input-multiple::main(), input-sizes::main(), mouse::main(), input::main(), mouse-complex::main(), multiple-windows-complex::main(), mouse-complex-buttons::main(), nested-rows-columns::main(), trackbar::main(), trackbar-complex::main(), trackbar-sparkline::main(), button-shortcut::main(), ui-enhanced-window-component::main(), ui-enhanced-canny::main(), row-column::main(), multiple-windows-complex-dynamic::main(), and Class2.Class2::renderMessage().
void cvui::text | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
const cv::String & | theText, | ||
double | theFontScale = 0.4 , |
||
unsigned int | theColor = 0xCECECE |
||
) |
Display a piece of text.
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theText | the text content. |
theFontScale | size of the text. |
theColor | color of the text in the format 0xRRGGBB , e.g. 0xff0000 for red. |
Referenced by group(), main(), and Class2::renderMessage().
bool cvui::trackbar | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
int | theWidth, | ||
num_type * | theValue, | ||
num_type | theMin, | ||
num_type | theMax, | ||
int | theSegments, | ||
const char * | theLabelFormat, | ||
unsigned int | theOptions, | ||
num_type | theDiscreteStep | ||
) |
bool cvui::trackbar | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
int | theWidth, | ||
T * | theValue, | ||
T | theMin, | ||
T | theMax, | ||
int | theSegments = 1 , |
||
const char * | theLabelFormat = "%.1Lf" , |
||
unsigned int | theOptions = 0 , |
||
T | theDiscreteStep = 1 |
||
) |
Display a trackbar for numeric values that the user can increase/decrease by clicking and/or dragging the marker right or left.
This component uses templates so it is imperative that you make it very explicit the type of theValue
, theMin
, theMax
and theStep
, otherwise you might end up with weird compilation errors.
Example:
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theWidth | the width of the trackbar. |
theValue | the current value of the trackbar. It will be modified when the user interacts with the trackbar. Any numeric type can be used, e.g. float, double, long double, int, char, uchar. |
theMin | minimum value allowed for the trackbar. |
theMax | maximum value allowed for the trackbar. |
theSegments | number of segments the trackbar will have (default is 1). Segments can be seen as groups of numbers in the scale of the trackbar. For example, 1 segment means a single groups of values (no extra labels along the scale), 2 segments mean the trackbar values will be divided in two groups and a label will be placed at the middle of the scale. |
theLabelFormat | formating string that will be used to render the labels, e.g. %.2Lf (Lf not lf). No matter the type of the theValue param, internally trackbar stores it as a long double , so the formating string will *always receive a long double value to format. If you are using a trackbar with integers values, for instance, you can supress decimals using a formating string such as %.0Lf to format your labels. |
theOptions | options to customize the behavior/appearance of the trackbar, expressed as a bitset. Available options are defined as TRACKBAR_ constants and they can be combined using the bitwise | operand. Available options are: TRACKBAR_HIDE_SEGMENT_LABELS (do not render segment labels, but do render min/max labels), TRACKBAR_HIDE_STEP_SCALE (do not render the small lines indicating values in the scale), TRACKBAR_DISCRETE (changes of the trackbar value are multiples of theDiscreteStep param), TRACKBAR_HIDE_MIN_MAX_LABELS (do not render min/max labels), TRACKBAR_HIDE_VALUE_LABEL (do not render the current value of the trackbar below the moving marker), TRACKBAR_HIDE_LABELS (do not render labels at all). |
theDiscreteStep | amount that the trackbar marker will increase/decrease when the marker is dragged right/left (if option TRACKBAR_DISCRETE is ON) |
true
when the value of the trackbar changed.Referenced by main().
bool cvui::trackbar | ( | int | theWidth, |
num_type * | theValue, | ||
num_type | theMin, | ||
num_type | theMax, | ||
int | theSegments, | ||
const char * | theLabelFormat, | ||
unsigned int | theOptions, | ||
num_type | theDiscreteStep | ||
) |
bool cvui::trackbar | ( | int | theWidth, |
T * | theValue, | ||
T | theMin, | ||
T | theMax, | ||
int | theSegments = 1 , |
||
const char * | theLabelFormat = "%.1Lf" , |
||
unsigned int | theOptions = 0 , |
||
T | theDiscreteStep = 1 |
||
) |
Display a trackbar for numeric values that the user can increase/decrease by clicking and/or dragging the marker right or left.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
This component uses templates so it is imperative that you make it very explicit the type of theValue
, theMin
, theMax
and theStep
, otherwise you might end up with weird compilation errors.
Example:
theWidth | the width of the trackbar. |
theValue | the current value of the trackbar. It will be modified when the user interacts with the trackbar. Any numeric type can be used, e.g. float, double, long double, int, char, uchar. |
theMin | minimum value allowed for the trackbar. |
theMax | maximum value allowed for the trackbar. |
theSegments | number of segments the trackbar will have (default is 1). Segments can be seen as groups of numbers in the scale of the trackbar. For example, 1 segment means a single groups of values (no extra labels along the scale), 2 segments mean the trackbar values will be divided in two groups and a label will be placed at the middle of the scale. |
theLabelFormat | formating string that will be used to render the labels, e.g. %.2Lf . No matter the type of the theValue param, internally trackbar stores it as a long double , so the formating string will always receive a long double value to format. If you are using a trackbar with integers values, for instance, you can supress decimals using a formating string as %.0Lf to format your labels. |
theOptions | options to customize the behavior/appearance of the trackbar, expressed as a bitset. Available options are defined as TRACKBAR_ constants and they can be combined using the bitwise | operand. Available options are: TRACKBAR_HIDE_SEGMENT_LABELS (do not render segment labels, but do render min/max labels), TRACKBAR_HIDE_STEP_SCALE (do not render the small lines indicating values in the scale), TRACKBAR_DISCRETE (changes of the trackbar value are multiples of informed step param), TRACKBAR_HIDE_MIN_MAX_LABELS (do not render min/max labels), TRACKBAR_HIDE_VALUE_LABEL (do not render the current value of the trackbar below the moving marker), TRACKBAR_HIDE_LABELS (do not render labels at all). |
theDiscreteStep | the amount that the trackbar marker will increase/decrease when the marker is dragged right/left (if option TRACKBAR_DISCRETE is ON) |
true
when the value of the trackbar changed.void cvui::update | ( | const cv::String & | theWindowName = "" | ) |
Update the library internal things.
You need to call this function AFTER you are done adding/manipulating UI elements in order for them to react to mouse interactions.
theWindowName | name of the window whose components are being updated. If no window name is provided, cvui uses the default window. |
Referenced by input-change-counter::main(), image-button::main(), input-react-key::main(), input-sizes::main(), input-detect-key::main(), main-app::main(), input-multiple::main(), canny::main(), mouse-complex::main(), multiple-windows-complex::main(), input::main(), interaction-area::main(), main(), nested-rows-columns::main(), mouse-complex-buttons::main(), multiple-files::main(), button-shortcut::main(), trackbar-sparkline::main(), on-image::main(), trackbar-complex::main(), trackbar::main(), ui-enhanced-canny::main(), row-column::main(), sparkline::main(), multiple-windows-complex-dynamic::main(), complex-layout::main(), multiple-windows::window(), and window().
void cvui::watch | ( | const cv::String & | theWindowName, |
bool | theCreateNamedWindow = true |
||
) |
Track UI interactions of a particular window.
This function must be invoked for any window that will receive cvui components. cvui automatically calls cvui::watch()
for any window informed in cvui::init()
, so generally you don't have to watch them yourself. If you initialized cvui and told it not to create windows automatically, you need to call cvui::watch()
on those windows yourself. cvui::watch()
can automatically create a window before watching it, if it does not exist.
theWindowName | name of the window whose UI interactions will be tracked. |
theCreateNamedWindow | if an OpenCV window named theWindowName should be created before it is watched. Windows are created using cv::namedWindow() . If this parameter is false , ensure you have called cv::namedWindow(WINDOW_NAME) to create the window, otherwise cvui will not be able to track its UI interactions. |
Referenced by main(), multiple-windows-complex::main(), multiple-windows-complex-dynamic::main(), multiple-windows-complex-dynamic::openWindow(), and openWindow().
void cvui::window | ( | cv::Mat & | theWhere, |
int | theX, | ||
int | theY, | ||
int | theWidth, | ||
int | theHeight, | ||
const cv::String & | theTitle | ||
) |
Display a window (a block with a title and a body).
theWhere | image/frame where the component should be rendered. |
theX | position X where the component should be placed. |
theY | position Y where the component should be placed. |
theWidth | width of the window. |
theHeight | height of the window. |
theTitle | text displayed as the title of the window. |
Referenced by EnhancedWindow::begin(), group(), main(), and Class1::renderInfo().
void cvui::window | ( | int | theWidth, |
int | theHeight, | ||
const cv::String & | theTitle | ||
) |
Display a window (a block with a title and a body) within a begin*()
and end*()
block.
IMPORTANT: this function can only be used within a begin*()/end*()
block, otherwise it does nothing.
theWidth | width of the window. |
theHeight | height of the window. |
theTitle | text displayed as the title of the window. |
Referenced by EnhancedWindow.EnhancedWindow::begin(), complex-layout::group(), main-app::main(), canny::main(), multiple-windows-complex::main(), on-image::main(), row-column::main(), and Class1.Class1::renderInfo().
const int cvui::CLICK = 3 |
Referenced by main().
const int cvui::COLUMN = 1 |
const int cvui::DOWN = 2 |
Referenced by EnhancedWindow::begin(), and main().
const unsigned int cvui::INTPUT_CURSOR_BLINK_SLOWNESS = 10 |
const int cvui::IS_DOWN = 7 |
Referenced by EnhancedWindow::begin(), and main().
const unsigned int cvui::KEY_ARROW_DOWN = 2621440 |
const unsigned int cvui::KEY_ARROW_LEFT = 2424832 |
const unsigned int cvui::KEY_ARROW_RIGHT = 2555904 |
const unsigned int cvui::KEY_ARROW_UP = 2490368 |
const unsigned int cvui::KEY_BACKSPACE = 8 |
const unsigned int cvui::KEY_DELETE = 3014656 |
const unsigned int cvui::KEY_END = 2293760 |
const unsigned int cvui::KEY_ENTER = 13 |
Referenced by main().
const unsigned int cvui::KEY_HOME = 2359296 |
const unsigned int cvui::KEY_NONE = -1 |
const unsigned int cvui::KEY_TAB = 9 |
const int cvui::LEFT_BUTTON = 0 |
Referenced by main().
const int cvui::MIDDLE_BUTTON = 1 |
const int cvui::OUT = 5 |
Referenced by main().
const int cvui::OVER = 4 |
Referenced by main().
const int cvui::RIGHT_BUTTON = 2 |
Referenced by main().
const int cvui::ROW = 0 |
const unsigned int cvui::TRACKBAR_DISCRETE = 4 |
Referenced by main().
const unsigned int cvui::TRACKBAR_HIDE_LABELS = 32 |
const unsigned int cvui::TRACKBAR_HIDE_MIN_MAX_LABELS = 8 |
const unsigned int cvui::TRACKBAR_HIDE_SEGMENT_LABELS = 1 |
Referenced by main().
const unsigned int cvui::TRACKBAR_HIDE_STEP_SCALE = 2 |
const unsigned int cvui::TRACKBAR_HIDE_VALUE_LABEL = 16 |
const int cvui::UP = 6 |
Referenced by main().