April 2017
Beginner to intermediate
250 pages
6h 28m
English
Now that all the tools have been assembled to get 6 degrees of freedom head tracking, we can apply it to a camera stream or video file. OpenCV provides the VideoCapture class that can be used in the following manner (see the Accessing the webcam section in Chapter 1, Cartoonifier and Skin Changer for Raspberry Pi, for more details):
#include "opencv2/opencv.hpp" using namespace cv; int main(int, char**) { VideoCapture cap(0);// opens the default camera, could use a // video file path instead if(!cap.isOpened()) // check if we succeeded return -1; AAM aam = loadPreviouslyTrainedAAM(); HeadModel headModel = load3DHeadModel(); Mapping mapping = mapAAMLandmarksToHeadModel(); Pose2D pose = detectFacePosition(); ...Read now
Unlock full access