Webcam Tracker
V1.0
Using openCV and an Arduino Uno
|
Contains the graphic user interface main class. Member of GUI classes Graphic group. More...
#include <GUI.h>
Public Member Functions | |
GUI () | |
Default constructor. | |
GUI (vector< PipeLineAction * > actions) | |
Constructor. More... | |
void | showOutput (cv::Mat &src, cv::Point *trackingPoint) |
shows the output Matrix to the user More... | |
void | showWindows (vector< PipeLineAction * > actions) |
shows pipeline action windows depending on the state of the corresponding menu button More... | |
void | addMessage (string message) |
adds a message to the GUI console More... | |
bool | trackingActive () |
gets the tracking state More... | |
Private Member Functions | |
void | createButtonStates () |
Constructs the button state vector. More... | |
void | checkButtonStates () |
Checks the state of all menu buttons. More... | |
Static Private Member Functions | |
static void | onMouse (int event, int x, int y, int, void *userdata) |
mouse call back function More... | |
Private Attributes | |
const cv::String | sourceWindow = "Tracking application" |
Name of the GUI window. | |
Menu | menu |
Object holding the menu class. | |
Console | console |
Object holding the console class. | |
vector< bool > | buttonStates |
All button states, from the menu in one vector. | |
bool | tracking |
Tracking active flag. | |
Contains the graphic user interface main class. Member of GUI classes Graphic group.
GUI::GUI | ( | vector< PipeLineAction * > | actions | ) |
Constructor.
Creates a named window, a menu and a console. The menu buttons are named after the pipeline actions. Lines up the buttons length wise and creates a mouse event listener
actions | vector containing pointers to all pipeline actions |
|
private |
Constructs the button state vector.
Loops over all buttons in the menu, adds the current state to the vector
|
private |
Checks the state of all menu buttons.
Loops over all buttons in the menu, sets its state in the vector
|
staticprivate |
mouse call back function
is called when a mouse event occurs, checks if it was a left-mousbutton press and checks if the x,y coordinates are within a button.
event | event type |
x | X-part of the mouse position |
y | Y-part of the mouse position |
userdata | pointer to the menu object. |
void GUI::showOutput | ( | cv::Mat & | src, |
cv::Point * | trackingPoint | ||
) |
shows the output Matrix to the user
Including the tracking point
src | source matrix where the trackingPoint is drawn to |
trackingPoint | center of the object to be tracked. |
void GUI::showWindows | ( | vector< PipeLineAction * > | actions | ) |
shows pipeline action windows depending on the state of the corresponding menu button
Loops over all actions and button states, showing or hiding the action windows. Also sets the tracking flag accourding to its button state
actions | vector containing pointers to all pipeline actions |
void GUI::addMessage | ( | string | message | ) |
adds a message to the GUI console
message | string containing the message |
bool GUI::trackingActive | ( | ) |
gets the tracking state