http://wiki.ros.org/face_recognition
$ cd ~/catkin_ws/src
$ git clone https://github.com/procrob/procrob_functional.git --branch catkin //下载程序包,完成后可见在 cd ~/catkin_ws/src下有procrob_functional文件夹
$ cd ~/catkin_ws
$ catkin_make //编译
$ source ~/catkin_ws/devel/setup.bash
在data文件夹中是训练样本,可添加新的样本。之后按格式修改train.txt。
Training images are stored in the data directory.
Training images are listed in the train.text file.
The 'train.txt' follows a specific format which is best understood by looking at the exampletrain.txt file provided in the package. Note that person numbers start from 1, and spaces or special characters are not allowed in persons' names).
The program trains from the training examples listed in thetrain.txt and create an Eigenfaces database which is stored in thefacedata.xml file.
Face detection is performed using a haarcascade classifier (haarcascade_frontalface_alt.xml).
The data folder, and train.txt, facedata.xml and haarcascade_frontalface_alt.xmlfiles should be placed in the program's working directory (i.e. the directory from which you execute the program).
Iffacedata.xml exists, the Eigenfaces database is loaded from facedata.xml.
If facedata.xml does not exist, the program tries to train and create Eigenfaces database from the training images listed intrain.txt, if any.//所yi要先删除facedata.xml
Regardless of if the Eigenfaces database is loaded/created at start up or not, you can always add training images directly from the video stream and then update the Eigenfaces database by (re)training.
Note: when the program (re)trains, the content of facedata.xml is disregarded and the program trains only based on the training images listed in train.txt.
打开新终端
$roscore
$roslaunch openni_launch openni.launch //打开kinect
打开新终端
rosrun image_view image_view image:=/camera/rgb/image_color //打开彩色摄像头
在另外的终端
$ cd ~/catkin_ws
$ source ~/catkin_ws/devel/setup.bash
$ roscd face_recognition
$ rosrun face_recognition Fserver
在新终端
$ cd ~/catkin_ws
$ source ~/catkin_ws/devel/setup.bash
$ rosrun face_recognition Fclient
- In another terminal publish following messages on topic /fr_order to test different face recognition functionalities.
- After each command notice the output of Fserver and Fclient.
$ rostopic pub -1 /fr_order face_recognition/FRClientGoal -- 2 "your_name"