-
Notifications
You must be signed in to change notification settings - Fork 78
3. Personalized Template Creation
In this example, we will create a 3D template of your face. This template will be required in the next examples for real-time head pose estimation and facial expression analysis.
The code of this example is given in the TemplateCreator.cpp file. To run it first build FaceCept3D with your toolchain, and make sure your Kinect is working. Try running pcl_openni_viewer on Linux. On Windows, any sample from the MS Kinect SDK will suit that goal. If this doesn’t work, then first resolve this problem. Installation instruction are here.
If you want to know more on how TemplateCreator works read this.
In order to run TemplateCreator, you need to put a setting.ini to the same folder where the binary is. For this example, this file should contain the following two lines:
Template=MyTemplate.pcd
Landmarks=MyTemplateLandmarks.txt
These two lines specify the two files: where to store the final template, and where to put the corresponding face landmarks. These files will be required for head pose estimation and facial expression recognition.
Let’s start. Run it:
./TemplateCreator
You will be prompted to select a face region first. As it is explained in the window, you need to select four points on your face in the following order:
- Leftmost point
- Rightmost point
- Point somewhere on your forehead
- Point a little bit above the chin
To select a point press SHIFT+Left Click. To delete the last point press DELETE. When done press space. NOTE: Make sure you're seeing the front part of your face, try rotation the view, to see what I mean.
See the image for an example:
Now the next window will appear. Slowly rotate your head center-left-right-center showing your cheeks to Kinect. When finished with rotation select the last window and press escape.
It will take a second or so to perform interpolation and smoothing of your template, and finally you will see the result. You will be asked to select 3 points on your face. Use the following figure:
When you press SPACE the template and the landmarks will be saved to disk as is specified in settings.ini.
You can control the density of the final point cloud by changing the voxelization parameter.
t = Voxelize<pcl::PointXYZRGBA>(t, 0.0025);
If you want to get the maximum density, just comment this line.