icub-client
Classes

Face tracking module for iCub head and gaze using OpenCV functions Version:1.0. More...

+ Collaboration diagram for faceTracker:

Classes

class  faceTrackerModule
 

Detailed Description

Face tracking module for iCub head and gaze using OpenCV functions Version:1.0.

Author
Hyung Jin Chang hj.ch.nosp@m.ang@.nosp@m.imper.nosp@m.ial..nosp@m.ac.uk

Description

Using the face detection functions of OpenCV, the iCub is detecting faces every frame. Then, it tries to follow the located face in the middle of the view by moving the head and eyes simultaneously. Only the images of the left eye are used for tracking (not both eyes). There are several modes which are internally used for the tracking: 'set position mode', 'face tracking mode, and 'face searching mode'.

Parameters

Input Ports

Output Ports

Services


Class Documentation

◆ faceTrackerModule

class faceTrackerModule

Definition at line 38 of file faceTracker.h.

+ Inheritance diagram for faceTrackerModule:

Public Member Functions

bool configure (yarp::os::ResourceFinder &rf)
 configure all the module parameters and return true if successful More...
 
bool interruptModule ()
 interrupt the ports More...
 
bool close ()
 close and shut down the module More...
 
bool respond (const yarp::os::Bottle &command, yarp::os::Bottle &reply)
 
double getPeriod ()
 
bool updateModule ()
 get an image from the robot's camera and decide which mode should be chosen next More...
 

Protected Types

enum  Mode {
  Mode::GO_DEFAULT,
  Mode::FACE_SEARCHING,
  Mode::FACE_TRACKING,
  Mode::PAUSED
}
 

Protected Member Functions

void moveToDefaultPosition ()
 Move to center position (after being stuck) More...
 
void faceSearching (bool face_found)
 Randomly move around. More...
 
void faceTracking (const std::vector< cv::Rect > &faces_left, int biggest_face_left_idx)
 If a face was found, track it. More...
 

Protected Attributes

double x_buf
 
double y_buf
 
Mode mode
 
int counter_no_face_found
 if in face tracking mode, for how many iterations was no face found More...
 
int setpos_counter
 how many iterations have we spend in default position mode More...
 
int panning_counter
 how many times have we spend in face searching mode. More...
 
int stuck_counter
 
int tilt_target
 tilt target for face search mode (randomly chosen) More...
 
int pan_target
 pan target for face search mode (randomly chosen) More...
 
int pan_max
 maximum pan for the iCub More...
 
int tilt_max
 maximum tilt for the iCub More...
 
int nr_jnts
 number of joints of the iCub head More...
 
cv::CascadeClassifier face_classifier_left
 
IplImage * cvIplImageLeft
 

Member Enumeration Documentation

◆ Mode

enum faceTrackerModule::Mode
strongprotected
Enumerator
GO_DEFAULT 
FACE_SEARCHING 
FACE_TRACKING 
PAUSED 

Definition at line 58 of file faceTracker.h.

Member Function Documentation

◆ close()

bool faceTrackerModule::close ( )

close and shut down the module

Definition at line 137 of file faceTracker.cpp.

◆ configure()

bool faceTrackerModule::configure ( yarp::os::ResourceFinder &  rf)

configure all the module parameters and return true if successful

Definition at line 29 of file faceTracker.cpp.

◆ faceSearching()

void faceTrackerModule::faceSearching ( bool  face_found)
protected

Randomly move around.

Definition at line 207 of file faceTracker.cpp.

◆ faceTracking()

void faceTrackerModule::faceTracking ( const std::vector< cv::Rect > &  faces_left,
int  biggest_face_left_idx 
)
protected

If a face was found, track it.

Definition at line 235 of file faceTracker.cpp.

◆ getPeriod()

double faceTrackerModule::getPeriod ( )

Definition at line 175 of file faceTracker.cpp.

◆ interruptModule()

bool faceTrackerModule::interruptModule ( )

interrupt the ports

Definition at line 130 of file faceTracker.cpp.

◆ moveToDefaultPosition()

void faceTrackerModule::moveToDefaultPosition ( )
protected

Move to center position (after being stuck)

Definition at line 179 of file faceTracker.cpp.

◆ respond()

bool faceTrackerModule::respond ( const yarp::os::Bottle &  command,
yarp::os::Bottle &  reply 
)

Definition at line 149 of file faceTracker.cpp.

◆ updateModule()

bool faceTrackerModule::updateModule ( )

get an image from the robot's camera and decide which mode should be chosen next

Definition at line 340 of file faceTracker.cpp.

Member Data Documentation

◆ counter_no_face_found

int faceTrackerModule::counter_no_face_found
protected

if in face tracking mode, for how many iterations was no face found

Definition at line 60 of file faceTracker.h.

◆ cvIplImageLeft

IplImage* faceTrackerModule::cvIplImageLeft
protected

Definition at line 73 of file faceTracker.h.

◆ face_classifier_left

cv::CascadeClassifier faceTrackerModule::face_classifier_left
protected

Definition at line 72 of file faceTracker.h.

◆ mode

Mode faceTrackerModule::mode
protected

Definition at line 59 of file faceTracker.h.

◆ nr_jnts

int faceTrackerModule::nr_jnts
protected

number of joints of the iCub head

Definition at line 70 of file faceTracker.h.

◆ pan_max

int faceTrackerModule::pan_max
protected

maximum pan for the iCub

Definition at line 68 of file faceTracker.h.

◆ pan_target

int faceTrackerModule::pan_target
protected

pan target for face search mode (randomly chosen)

Definition at line 67 of file faceTracker.h.

◆ panning_counter

int faceTrackerModule::panning_counter
protected

how many times have we spend in face searching mode.

If >5, go back to default position

Definition at line 62 of file faceTracker.h.

◆ setpos_counter

int faceTrackerModule::setpos_counter
protected

how many iterations have we spend in default position mode

Definition at line 61 of file faceTracker.h.

◆ stuck_counter

int faceTrackerModule::stuck_counter
protected

Definition at line 63 of file faceTracker.h.

◆ tilt_max

int faceTrackerModule::tilt_max
protected

maximum tilt for the iCub

Definition at line 69 of file faceTracker.h.

◆ tilt_target

int faceTrackerModule::tilt_target
protected

tilt target for face search mode (randomly chosen)

Definition at line 66 of file faceTracker.h.

◆ x_buf

double faceTrackerModule::x_buf
protected

Definition at line 55 of file faceTracker.h.

◆ y_buf

double faceTrackerModule::y_buf
protected

Definition at line 56 of file faceTracker.h.