Gestro
|
This class takes care of starting threads to capture image, process and publish commands. More...
#include <CaptureAndDetect.h>
Public Member Functions | |
CaptureAndDetect () | |
void | init (ControllerScreenCallbackInterface *, int, int, EnabledCommand *, Resolution width=WIDTH_1280, Resolution height=HEIGHT_720) |
void | calibrateValues (int, int, int, int) |
void | newFrame (Mat) override |
void | calibrateColorPressed () |
void | calibrateBackgroundRemover () |
void | displayImage (int) |
void | connectControlCallback (DisplayControlCallbackInterface *) |
void | processFrame () |
void | addToBuffer (FingerAndCoordinates) override |
Public Attributes | |
bool | calibrate = false |
Mat | recievedFrame |
frame received from capture thread More... | |
Private Member Functions | |
void | processCommands () |
Private Attributes | |
Mat | currentFrame |
current frame being processed More... | |
FingerAndCoordinates | fingerAndCoordinates |
Fingercoordinate object to store the response. More... | |
SkinColorDetector | skinDetector |
SkinColorDetecter object. More... | |
FingerCounter | fingerCounter |
FingerCounter object. More... | |
Ptr< BackgroundSubtractor > | backgroundRemover |
Bacground substractor object. More... | |
Rect | roi |
Region of interest to track the fingers. More... | |
ControllerScreenCallbackInterface * | callback |
callback to controller screen GUI More... | |
DisplayControlCallbackInterface * | controlInterface |
callback to Display Control to send ubuntu commands More... | |
Capture | capture |
Capture object. More... | |
thread | uthread |
thread to start processing images More... | |
thread | commandThread |
thread to check for commands and forward to DisplayControl More... | |
queue< FingerAndCoordinates > | detectedFingers |
buffer to store the finger count, listened by command thread More... | |
EnabledCommand * | commands |
int | displayWidth |
width of the display More... | |
int | displayHeight |
height of the display More... | |
int | toDisplay = UNPROCESSED |
feed to display More... | |
bool | backgroundCalibrated = false |
bool to check is background has been calibrated More... | |
bool | frameRecieved = false |
boolean flag to check if recieved new frame from Capture More... | |
This class takes care of starting threads to capture image, process and publish commands.
This class is the mediator between the different functions of the application. Connecting between image capturing, GUI and and DisplayControl to publish the detected commands.
Definition at line 41 of file CaptureAndDetect.h.
CaptureAndDetect::CaptureAndDetect | ( | ) |
The constructor for the CaptureAndDetect class.
Definition at line 5 of file CaptureAndDetect.cpp.
|
overridevirtual |
It adds a finger to the buffer
finger | The finger that was detected. |
Implements Gestro::CaptureAndDetectCallbackInterface.
Definition at line 160 of file CaptureAndDetect.cpp.
void CaptureAndDetect::calibrateBackgroundRemover | ( | ) |
It creates a background remover object that will be used to remove the background from the video frames
Definition at line 147 of file CaptureAndDetect.cpp.
void CaptureAndDetect::calibrateColorPressed | ( | ) |
It calls the calibrate function of the skinDetector object, which returns a vector of 4 integers, which are then passed to the callback function updateCalibratedTrackbar, which updates the trackbar values
Definition at line 142 of file CaptureAndDetect.cpp.
void CaptureAndDetect::calibrateValues | ( | int | hMin, |
int | hMax, | ||
int | sMin, | ||
int | sMax | ||
) |
It takes in the minimum and maximum values for the hue and saturation channels, and then passes them to the skinDetector object's calibrateValues() function
hMin | Minimum Hue value |
hMax | The maximum hue value for the skin color. |
sMin | Minimum saturation value for the skin color. |
sMax | The maximum saturation value for the skin color. |
Definition at line 22 of file CaptureAndDetect.cpp.
void CaptureAndDetect::connectControlCallback | ( | DisplayControlCallbackInterface * | interface | ) |
This function is called by the DisplayControl class to connect the CaptureAndDetect class to the DisplayControl class.
interface | The interface that will be used to communicate with the display control. |
Definition at line 156 of file CaptureAndDetect.cpp.
void CaptureAndDetect::displayImage | ( | int | feed | ) |
It sets the value of the variable toDisplay to the value of the parameter feed
feed | The feed to display. |
Definition at line 152 of file CaptureAndDetect.cpp.
void CaptureAndDetect::init | ( | ControllerScreenCallbackInterface * | interface, |
int | screenWidth, | ||
int | screenHeight, | ||
EnabledCommand * | enabledCommand, | ||
Resolution | width = WIDTH_1280 , |
||
Resolution | height = HEIGHT_720 |
||
) |
It initializes the capture and detection threads, and starts them
interface | The interface to call when a gesture is detected. |
screenWidth | The width of the screen in pixels |
screenHeight | The height of the screen in pixels |
enabledCommand | This is a pointer to an EnabledCommand object. This object is used to determine if the user has enabled the finger counter. |
width | The width of the camera image |
height | The height of the camera's resolution. |
Definition at line 8 of file CaptureAndDetect.cpp.
|
overridevirtual |
This function is called by the camera thread when a new frame is available. It sets the recievedFrame variable to the new frame and sets the frameRecieved variable to true.
incomingFrame | The frame that was recieved from the camera. |
Implements Gestro::CaptureAndDetectCallbackInterface.
Definition at line 29 of file CaptureAndDetect.cpp.
|
private |
It takes the commands from the queue and executes them
Definition at line 86 of file CaptureAndDetect.cpp.
void CaptureAndDetect::processFrame | ( | ) |
It takes a frame from the camera, processes it, and sends it to the GUI to be displayed
Definition at line 35 of file CaptureAndDetect.cpp.
|
private |
bool to check is background has been calibrated
Definition at line 173 of file CaptureAndDetect.h.
|
private |
Bacground substractor object.
Definition at line 138 of file CaptureAndDetect.h.
bool Gestro::CaptureAndDetect::calibrate = false |
Definition at line 88 of file CaptureAndDetect.h.
|
private |
callback to controller screen GUI
Definition at line 144 of file CaptureAndDetect.h.
|
private |
Capture object.
Definition at line 150 of file CaptureAndDetect.h.
|
private |
Definition at line 161 of file CaptureAndDetect.h.
|
private |
thread to check for commands and forward to DisplayControl
Definition at line 156 of file CaptureAndDetect.h.
|
private |
callback to Display Control to send ubuntu commands
Definition at line 147 of file CaptureAndDetect.h.
|
private |
current frame being processed
Definition at line 126 of file CaptureAndDetect.h.
|
private |
buffer to store the finger count, listened by command thread
Definition at line 159 of file CaptureAndDetect.h.
|
private |
height of the display
Definition at line 167 of file CaptureAndDetect.h.
|
private |
width of the display
Definition at line 164 of file CaptureAndDetect.h.
|
private |
Fingercoordinate object to store the response.
Definition at line 129 of file CaptureAndDetect.h.
|
private |
FingerCounter object.
Definition at line 135 of file CaptureAndDetect.h.
|
private |
boolean flag to check if recieved new frame from Capture
Definition at line 176 of file CaptureAndDetect.h.
Mat Gestro::CaptureAndDetect::recievedFrame |
frame received from capture thread
Definition at line 122 of file CaptureAndDetect.h.
|
private |
Region of interest to track the fingers.
Definition at line 141 of file CaptureAndDetect.h.
|
private |
SkinColorDetecter object.
Definition at line 132 of file CaptureAndDetect.h.
|
private |
feed to display
Definition at line 170 of file CaptureAndDetect.h.
|
private |
thread to start processing images
Definition at line 153 of file CaptureAndDetect.h.