21 #ifndef _FACETRACKER_MODULE_H_ 22 #define _FACETRACKER_MODULE_H_ 29 #include <opencv2/opencv.hpp> 31 #include <yarp/os/all.h> 32 #include <yarp/sig/all.h> 33 #include <yarp/dev/all.h> 39 yarp::os::RpcServer handlerPort;
40 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > imagePortLeft;
42 yarp::dev::IVelocityControl *vel;
43 yarp::dev::IEncoders *enc;
45 yarp::dev::PolyDriver *robotHead;
47 yarp::sig::VectorOf<double> velocity_command;
48 yarp::sig::VectorOf<double> cur_encoders;
50 yarp::dev::IControlMode *ictrl;
52 int getBiggestFaceIdx(
const cv::Mat& cvMatImageLeft,
const std::vector<cv::Rect> &faces_left);
88 void faceTracking(
const std::vector<cv::Rect> &faces_left,
int biggest_face_left_idx);
95 bool respond(
const yarp::os::Bottle&
command, yarp::os::Bottle& reply);
100 #endif // __FACETRACKER_MODULE_H__ bool configure(yarp::os::ResourceFinder &rf)
configure all the module parameters and return true if successful
int setpos_counter
how many iterations have we spend in default position mode
bool updateModule()
get an image from the robot's camera and decide which mode should be chosen next
int nr_jnts
number of joints of the iCub head
bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply)
void moveToDefaultPosition()
Move to center position (after being stuck)
cv::CascadeClassifier face_classifier_left
int tilt_max
maximum tilt for the iCub
int pan_max
maximum pan for the iCub
int counter_no_face_found
if in face tracking mode, for how many iterations was no face found
int panning_counter
how many times have we spend in face searching mode.
void faceSearching(bool face_found)
Randomly move around.
IplImage * cvIplImageLeft
int tilt_target
tilt target for face search mode (randomly chosen)
int pan_target
pan target for face search mode (randomly chosen)
bool close()
close and shut down the module
bool interruptModule()
interrupt the ports
void faceTracking(const std::vector< cv::Rect > &faces_left, int biggest_face_left_idx)
If a face was found, track it.