motion detection with opencv in the hope to minimize the memory consumption on pi.