I guess you have to same assignment: Video Processing with a Rasperry Pi
You should find the answer there.