cvui
A (very) simple UI lib built on top of OpenCV drawing primitives
cvui.h File Reference
#include <iostream>
#include <vector>
#include <map>
#include <stdarg.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
Include dependency graph for cvui.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  cvui::cvui_block_t
 
struct  cvui::cvui_context_t
 
struct  cvui::cvui_input_t
 
struct  cvui::cvui_label_t
 
struct  cvui::cvui_mouse_btn_t
 
struct  cvui::cvui_mouse_t
 

Namespaces

 cvui
 

Macros

#define _CVUI_IMPLEMENTATION_NOTICE   "cvui.h: compiling implementation because of CVUI_IMPLEMENTATION. See: https://dovyski.github.io/cvui/usage/"
 
#define _CVUI_NO_IMPLEMENTATION_NOTICE   "cvui.h: implementation skipped. Ensure one of your C++ files included cvui.h after a #define CVUI_IMPLEMENTATION. See: https://dovyski.github.io/cvui/usage/"
 
#define CVUI_ANTIALISED   CV_AA
 
#define CVUI_FILLED   -1
 
#define sprintf_s   sprintf
 
#define vsprintf_s   vsprintf
 

Functions

void cvui::beginColumn (cv::Mat &theWhere, int theX, int theY, int theWidth=-1, int theHeight=-1, int thePadding=0)
 Start a new column. More...
 
void cvui::beginColumn (int theWidth=-1, int theHeight=-1, int thePadding=0)
 Start a column. More...
 
void cvui::beginRow (cv::Mat &theWhere, int theX, int theY, int theWidth=-1, int theHeight=-1, int thePadding=0)
 Start a new row. More...
 
void cvui::beginRow (int theWidth=-1, int theHeight=-1, int thePadding=0)
 Start a row. More...
 
bool cvui::button (const cv::String &theLabel)
 Display a button within a begin*() and end*() block. More...
 
bool cvui::button (cv::Mat &theIdle, cv::Mat &theOver, cv::Mat &theDown)
 Display a button whose graphics are images (cv::Mat). More...
 
bool cvui::button (cv::Mat &theWhere, int theX, int theY, const cv::String &theLabel)
 Display a button. More...
 
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). More...
 
bool cvui::button (cv::Mat &theWhere, int theX, int theY, int theWidth, int theHeight, const cv::String &theLabel)
 Display a button. More...
 
bool cvui::button (int theWidth, int theHeight, const cv::String &theLabel)
 Display a button within a begin*() and end*() block. More...
 
bool cvui::checkbox (const cv::String &theLabel, bool *theState, unsigned int theColor=0xCECECE)
 Display a checkbox within a begin*() and end*() block. More...
 
bool cvui::checkbox (cv::Mat &theWhere, int theX, int theY, const cv::String &theLabel, bool *theState, unsigned int theColor=0xCECECE)
 Display a checkbox. More...
 
void cvui::context (const cv::String &theWindowName)
 Inform cvui that all subsequent component calls belong to a window in particular. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void cvui::endColumn ()
 End a column. More...
 
void cvui::endRow ()
 Ends a row. More...
 
void cvui::handleMouse (int theEvent, int theX, int theY, int theFlags, void *theData)
 
bool cvui::headless ()
 Inform if cvui is running in headless more. More...
 
void cvui::headless (bool theValue)
 Enable/disable headless more. More...
 
int cvui::iarea (int theX, int theY, int theWidth, int theHeight)
 Create an interaction area that reports activity with the mouse cursor. More...
 
void cvui::image (cv::Mat &theImage)
 Display an image (cv::Mat) within a begin*() and end*() block. More...
 
void cvui::image (cv::Mat &theWhere, int theX, int theY, cv::Mat &theImage)
 Display an image (cv::Mat). More...
 
void cvui::imshow (const cv::String &theWindowName, cv::InputArray theFrame)
 Display an image in the specified window and update the internal structures of cvui. More...
 
void cvui::init (const cv::String &theWindowName, int theDelayWaitKey=-1, bool theCreateNamedWindow=true, bool theHeadlessMode=false)
 Initializes cvui. More...
 
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. More...
 
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. More...
 
int cvui::lastKeyPressed ()
 Return the last key that was pressed. More...
 
bool cvui::mouse (const cv::String &theWindowName, int theButton, int theQuery)
 Query the mouse for events in a particular button in a particular window. More...
 
bool cvui::mouse (const cv::String &theWindowName, int theQuery)
 Query the mouse for events in a particular window. More...
 
cv::Point cvui::mouse (const cv::String &theWindowName="")
 Return the last position of the mouse. More...
 
bool cvui::mouse (int theButton, int theQuery)
 Query the mouse for events in a particular button. More...
 
bool cvui::mouse (int theQuery)
 Query the mouse for events, e.g. More...
 
void cvui::printf (const char *theFmt,...)
 Display a piece of text that can be formated using stdio's printf() style. More...
 
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. More...
 
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. More...
 
void cvui::printf (double theFontScale, unsigned int theColor, const char *theFmt,...)
 Display a piece of text within a begin*() and end*() block. More...
 
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. More...
 
void cvui::rect (int theWidth, int theHeight, unsigned int theBorderColor, unsigned int theFillingColor=0xff000000)
 Display a rectangle within a begin*() and end*() block. More...
 
void cvui::space (int theValue=5)
 Add an arbitrary amount of space between components within a begin*() and end*() block. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<typename num_type >
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)
 
template<typename T >
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. More...
 
template<typename num_type >
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)
 
template<typename T >
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. More...
 
void cvui::update (const cv::String &theWindowName="")
 Update the library internal things. More...
 
void cvui::watch (const cv::String &theWindowName, bool theCreateNamedWindow=true)
 Track UI interactions of a particular window. More...
 
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). More...
 
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. More...
 

Variables

const int cvui::CLICK = 3
 
const int cvui::COLUMN = 1
 
const int cvui::DOWN = 2
 
const unsigned int cvui::INTPUT_CURSOR_BLINK_SLOWNESS = 10
 
const int cvui::IS_DOWN = 7
 
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
 
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
 
const int cvui::MIDDLE_BUTTON = 1
 
const int cvui::OUT = 5
 
const int cvui::OVER = 4
 
const int cvui::RIGHT_BUTTON = 2
 
const int cvui::ROW = 0
 
const unsigned int cvui::TRACKBAR_DISCRETE = 4
 
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
 
const unsigned int cvui::TRACKBAR_HIDE_STEP_SCALE = 2
 
const unsigned int cvui::TRACKBAR_HIDE_VALUE_LABEL = 16
 
const int cvui::UP = 6
 

Macro Definition Documentation

◆ _CVUI_IMPLEMENTATION_NOTICE

#define _CVUI_IMPLEMENTATION_NOTICE   "cvui.h: compiling implementation because of CVUI_IMPLEMENTATION. See: https://dovyski.github.io/cvui/usage/"

◆ _CVUI_NO_IMPLEMENTATION_NOTICE

#define _CVUI_NO_IMPLEMENTATION_NOTICE   "cvui.h: implementation skipped. Ensure one of your C++ files included cvui.h after a #define CVUI_IMPLEMENTATION. See: https://dovyski.github.io/cvui/usage/"

◆ CVUI_ANTIALISED

#define CVUI_ANTIALISED   CV_AA

◆ CVUI_FILLED

#define CVUI_FILLED   -1

◆ sprintf_s

#define sprintf_s   sprintf

◆ vsprintf_s

#define vsprintf_s   vsprintf