This guy is a beast and made it incredibly easy to implement. After having taken 15 years off from writing code, I started programming again using RaspPI and Arduino a couple of months ago. Using Adrian's examples, in a day I put a motion detection system in place for a treat dispenser I built for my dog (playwithpickles.com for background if anyone cares) that records video only when the dog is in view.
It is, however, expensive both computationally and storage (OPenCV is ~3 GB on it's own) so if you dont' need perfection there are other techniques that just compare entire frames rather than segmenting the frames.