Go to the documentation of this file.00001
00002
00003 #ifndef FACE_FIND_H
00004 #define FACE_FIND_H
00005
00006
00007 #include <ros/ros.h>
00008
00009
00010 #include <image_geometry/pinhole_camera_model.h>
00011
00012
00013 #include <FaceWrapper.h>
00014
00015
00016 #include <pcl/point_cloud.h>
00017 #include <pcl/point_types.h>
00018
00019
00020 #include <laser_assembler/base_assembler.h>
00021
00022
00023 #include <QObject>
00024 #include <QImage>
00025
00026
00027 #include <portrait_robot_msgs/alubsc_status_msg.h>
00028 #include <portrait_robot_msgs/alubsc_node_instr.h>
00029
00030
00039 class FaceFind : public QObject
00040 {
00041 Q_OBJECT
00042
00043 public Q_SLOTS:
00044
00052 void ReceiveMouseEvent(int, int, int);
00053
00058 void EdgeImageFromFile(const char* filename);
00063 void PhotoFromFile(const char* photo, const char* mask);
00064
00065
00071 void Mirror();
00072
00073
00074 void PenButton();
00075 void EdgeButton();
00076 void PaintButton();
00077 void CornerButton();
00078 void HeadButton();
00079 void AbortButton();
00080
00081 Q_SIGNALS:
00082
00088 void newCameraImage(QImage);
00089
00090
00096 void newPhoto(QImage);
00097
00098
00104 void newMask(QImage);
00105
00106
00112 void setGUIInfo(QString);
00113
00119 void setGUIStatus(QString);
00120
00126 void newStatusMessage(int, QString);
00127
00133 void activateButton(int);
00134
00135 public :
00137 ros::ServiceClient prosilica_client;
00138
00140 ros::ServiceClient laserscanner_client;
00141
00143 ros::ServiceClient lasertilt_client;
00144
00145
00146 ros::ServiceClient pen_gripper_client;
00147 ros::ServiceClient contour_detector_client;
00148 ros::ServiceClient painter_client;
00149 ros::ServiceClient corner_client;
00150
00151
00156 FaceFind();
00157
00158
00159
00170 void ImageCBAll(const sensor_msgs::Image::ConstPtr &limage);
00171
00172
00179 void FacePosCBAll(const people_msgs::PositionMeasurement::ConstPtr &position);
00180
00181
00187 void CameraModelCBAll(const sensor_msgs::CameraInfoConstPtr& cam_info);
00188
00189
00195 void ProsilicaCameraModelCBAll(const sensor_msgs::CameraInfoConstPtr& cam_info);
00196
00197
00204 void ProsilicaCBAll(const sensor_msgs::Image::ConstPtr &image);
00205
00206
00212 bool StatusMessageCBAll(portrait_robot_msgs::alubsc_status_msg::Request &req,
00213 portrait_robot_msgs::alubsc_status_msg::Response &res);
00214
00215
00222 bool EdgeImageCBAll(portrait_robot_msgs::alubsc_node_instr::Request &req,
00223 portrait_robot_msgs::alubsc_node_instr::Response &res);
00224
00235 void TurnHead(cv::Point3d facecenter);
00236
00237
00247 void MakeMask(cv::Mat& maskImage);
00248
00249
00250
00256 void Cluster(cv::Mat_<cv::Vec3b>& copy, int n_x, int border_x, int inc_x, int n_y, int border_y, int inc_y);
00257
00258
00271 void AdjustLaser(geometry_msgs::Point p);
00272
00273
00288 void TakePhoto(uint index);
00289
00290
00297 QImage cvMat2QImage(const cv::Mat& image, unsigned int idx);
00298
00299 private:
00301 cv::Mat storedImage_;
00303 cv::Mat storedProsilicaImage_;
00305 cv::Mat storedPhoto_;
00307 cv::Mat storedMaskImage_;
00309 cv::Mat storedMirroredMaskImage_;
00311 cv::Mat edgeImage_;
00312
00314 std::deque<FaceWrapper> facesQueue_;
00315
00317 image_geometry::PinholeCameraModel model_;
00318
00320 image_geometry::PinholeCameraModel prosilicamodel_;
00321
00323 std::vector<cv::Mat> rgbaBuffer_;
00324
00326 cv::Point lastMousePosition_;
00327 int mouseClicked_;
00328
00339 bool CheckFaceBox(int x1, int y1, int x2, int y2);
00340
00341
00357 void StartPhoto(uint index);
00358
00359
00365 void MirrorPointCloud();
00366 bool mirror_;
00367 bool mirroredMaskExists_;
00368
00370 bool headBusy_;
00371
00373 int drawingCorners_;
00374
00376 ros::Time lastCameraImage_;
00377 };
00378
00379 #endif