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 Android, for more details):