Gestro
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
Gestro::CaptureAndDetect Class Reference

This class takes care of starting threads to capture image, process and publish commands. More...

#include <CaptureAndDetect.h>

Inheritance diagram for Gestro::CaptureAndDetect:
Inheritance graph
Collaboration diagram for Gestro::CaptureAndDetect:
Collaboration graph

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...
 
ControllerScreenCallbackInterfacecallback
 callback to controller screen GUI More...
 
DisplayControlCallbackInterfacecontrolInterface
 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< FingerAndCoordinatesdetectedFingers
 buffer to store the finger count, listened by command thread More...
 
EnabledCommandcommands
 
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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CaptureAndDetect()

CaptureAndDetect::CaptureAndDetect ( )

The constructor for the CaptureAndDetect class.

Definition at line 5 of file CaptureAndDetect.cpp.

Member Function Documentation

◆ addToBuffer()

void CaptureAndDetect::addToBuffer ( FingerAndCoordinates  finger)
overridevirtual

It adds a finger to the buffer

Parameters
fingerThe finger that was detected.

Implements Gestro::CaptureAndDetectCallbackInterface.

Definition at line 160 of file CaptureAndDetect.cpp.

◆ calibrateBackgroundRemover()

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.

◆ calibrateColorPressed()

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.

Here is the call graph for this function:

◆ calibrateValues()

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

Parameters
hMinMinimum Hue value
hMaxThe maximum hue value for the skin color.
sMinMinimum saturation value for the skin color.
sMaxThe maximum saturation value for the skin color.

Definition at line 22 of file CaptureAndDetect.cpp.

Here is the call graph for this function:

◆ connectControlCallback()

void CaptureAndDetect::connectControlCallback ( DisplayControlCallbackInterface interface)

This function is called by the DisplayControl class to connect the CaptureAndDetect class to the DisplayControl class.

Parameters
interfaceThe interface that will be used to communicate with the display control.

Definition at line 156 of file CaptureAndDetect.cpp.

Here is the caller graph for this function:

◆ displayImage()

void CaptureAndDetect::displayImage ( int  feed)

It sets the value of the variable toDisplay to the value of the parameter feed

Parameters
feedThe feed to display.

Definition at line 152 of file CaptureAndDetect.cpp.

◆ init()

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

Parameters
interfaceThe interface to call when a gesture is detected.
screenWidthThe width of the screen in pixels
screenHeightThe height of the screen in pixels
enabledCommandThis is a pointer to an EnabledCommand object. This object is used to determine if the user has enabled the finger counter.
widthThe width of the camera image
heightThe height of the camera's resolution.

Definition at line 8 of file CaptureAndDetect.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newFrame()

void CaptureAndDetect::newFrame ( Mat  incomingFrame)
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.

Parameters
incomingFrameThe frame that was recieved from the camera.

Implements Gestro::CaptureAndDetectCallbackInterface.

Definition at line 29 of file CaptureAndDetect.cpp.

◆ processCommands()

void CaptureAndDetect::processCommands ( )
private

It takes the commands from the queue and executes them

Definition at line 86 of file CaptureAndDetect.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processFrame()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ backgroundCalibrated

bool Gestro::CaptureAndDetect::backgroundCalibrated = false
private

bool to check is background has been calibrated

Definition at line 173 of file CaptureAndDetect.h.

◆ backgroundRemover

Ptr<BackgroundSubtractor> Gestro::CaptureAndDetect::backgroundRemover
private

Bacground substractor object.

Definition at line 138 of file CaptureAndDetect.h.

◆ calibrate

bool Gestro::CaptureAndDetect::calibrate = false

Definition at line 88 of file CaptureAndDetect.h.

◆ callback

ControllerScreenCallbackInterface* Gestro::CaptureAndDetect::callback
private

callback to controller screen GUI

Definition at line 144 of file CaptureAndDetect.h.

◆ capture

Capture Gestro::CaptureAndDetect::capture
private

Capture object.

Definition at line 150 of file CaptureAndDetect.h.

◆ commands

EnabledCommand* Gestro::CaptureAndDetect::commands
private

Definition at line 161 of file CaptureAndDetect.h.

◆ commandThread

thread Gestro::CaptureAndDetect::commandThread
private

thread to check for commands and forward to DisplayControl

Definition at line 156 of file CaptureAndDetect.h.

◆ controlInterface

DisplayControlCallbackInterface* Gestro::CaptureAndDetect::controlInterface
private

callback to Display Control to send ubuntu commands

Definition at line 147 of file CaptureAndDetect.h.

◆ currentFrame

Mat Gestro::CaptureAndDetect::currentFrame
private

current frame being processed

Definition at line 126 of file CaptureAndDetect.h.

◆ detectedFingers

queue<FingerAndCoordinates> Gestro::CaptureAndDetect::detectedFingers
private

buffer to store the finger count, listened by command thread

Definition at line 159 of file CaptureAndDetect.h.

◆ displayHeight

int Gestro::CaptureAndDetect::displayHeight
private

height of the display

Definition at line 167 of file CaptureAndDetect.h.

◆ displayWidth

int Gestro::CaptureAndDetect::displayWidth
private

width of the display

Definition at line 164 of file CaptureAndDetect.h.

◆ fingerAndCoordinates

FingerAndCoordinates Gestro::CaptureAndDetect::fingerAndCoordinates
private

Fingercoordinate object to store the response.

Definition at line 129 of file CaptureAndDetect.h.

◆ fingerCounter

FingerCounter Gestro::CaptureAndDetect::fingerCounter
private

FingerCounter object.

Definition at line 135 of file CaptureAndDetect.h.

◆ frameRecieved

bool Gestro::CaptureAndDetect::frameRecieved = false
private

boolean flag to check if recieved new frame from Capture

Definition at line 176 of file CaptureAndDetect.h.

◆ recievedFrame

Mat Gestro::CaptureAndDetect::recievedFrame

frame received from capture thread

Definition at line 122 of file CaptureAndDetect.h.

◆ roi

Rect Gestro::CaptureAndDetect::roi
private

Region of interest to track the fingers.

Definition at line 141 of file CaptureAndDetect.h.

◆ skinDetector

SkinColorDetector Gestro::CaptureAndDetect::skinDetector
private

SkinColorDetecter object.

Definition at line 132 of file CaptureAndDetect.h.

◆ toDisplay

int Gestro::CaptureAndDetect::toDisplay = UNPROCESSED
private

feed to display

Definition at line 170 of file CaptureAndDetect.h.

◆ uthread

thread Gestro::CaptureAndDetect::uthread
private

thread to start processing images

Definition at line 153 of file CaptureAndDetect.h.


The documentation for this class was generated from the following files: