removing moving foreground objects

I am trying to remove cars from a locked down video shot of a highway (similar to a long exposure photo would)

I am thinking that going through the sequence and averaging the pixels using ofxCvImages is the way to go but I am not sure how to approach it.

Any insights?

Found juliolucio’s-ofxDynamicBackground-class which does exactly what I want need if anyone is trying to do something similar