The way image recognition works is we first need to "train" a classifier.

To do this, we generally need to compile a massive set of images of what we're looking to detect (In this case face). 
For a lot of the image recognition tasks, people have already built data sets to use for the training part.
Face Detection is very popular, so there are already a lot of datasets for face data (face_p.xml for this project).

After training it checks if face is at the frame or not. if answer is yes it sets GPIO14 to LOW.
GPIO14 attached to skip button in mp3 player (in most of the mp3 players pressing button sets the pin to LOW).

( I used mp3 player to control it with GPIO. so if some one else want to use this code for controlling something else they can easily do it. )

and i attached a LED to GPIO 15 and it turns on for 1 second when there is a face in the frame.

the technique could be applied to a whole range of home automation tasks with some minor tweaks.

You can download the code from the YouTube video description.