Examples of using Principle Component Analysis in Processing with pca_transform.
This example demonstrates the most basic application of PCA to find the main axes of variation amongst some random 2D points.
This example uses OpenCV to reduce an image of a pen on a white background to a binary image (each pixel 100% white or black). It then treats these pixels as points to perform PCA. The resulting principle components make up the axes of orientation of the object.
<iframe src="http://player.vimeo.com/video/51174493?byline=0&portrait=0&color=ffffff" width="500" height="313" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>PCA Object Orientation Tracking with Processing from Greg Borenstein on Vimeo.
This example improves on the one above by applying the same technique to live video to find object orientation interactively.
This example uses the SimpleOpenNI Kinect library to access the depth points and joint data from the Kinect. It finds all of the depth points within a bounding box around a given joint (in this case, the head) and then conducts PCA on those points in order to find the orientation of the joint. This gives you head or hand orientation, which is otherwise not available from the Kinect joint data.