Ah, now that's a challenge!
You have both camera and object moving, in a cluttered scene, with changing illumination in a fast moving scene and it's a safety critical system.
What do you know about computer vision?
Consider disregarding what the object is. If it's in a particular place, moving in a particular way, it's an alarm condition.
Think about range and relative velocity.
Anything further away that D1 is no concern.
Anything closer than D1 and moving away is no concern.
Anything closer than D1 and moving toward is an alarm.
Anything closer than D2 is an alarm.
You might want more than one velocity sensitive range.
You could measure range and velocity with a stereo camera arrangement.
You could use 'optical flow' data to estimate range and velocity. The Pi can output motion vectors from the H264 encoder, so you could use that.
You could consider using a dopler radar module rather than vision (velocity).
There are also cheap LIDAR detectors available (distance) that might be worth a look. Search on sparkfun.com.
This might be helpful:
Volvo: Wouldn't you know it? Volvo, a company that feels about driving safety the way that Ferrari feels about auto racing, was the first to introduce an automated blind spot detection system into one of their cars back in 2005. It's called the Blind Spot Information System (BLIS), and it blissfully watches for approaching cars on both left and right that the driver can't see. Initially, it used cameras placed in the car's side rear view mirrors, and a computer processed the image from those cameras to see if anything looked like a car and seemed to be approaching dangerously into the area where you might hit it while changing lanes. Newer Volvo BLIS systems, however, use radar (electromagnetic waves that bounce off solid objects and return an echo indicating if they're there) and are mounted in the rear of the car, in the vicinity of the back bumpers. The presence of a hidden vehicle will cause an LED to glow on the A-pillar, the column at the edge of the windshield just to the left of the driver. If you switch on your turn signal to indicate that you plan to enter that lane, the light will start flashing, letting you know that your car is very nervous about your intended maneuver.
http://auto.howstuffworks.com/car-drivi ... erous1.htm