Place the IR LED in the path at a regular distance equal or little bit longer to then length of the car. Place the photodiode near the LED to received the reflected signals.
Now when their will be no car infront of the IR LED, their would not be any reflections of the waves. But when their is any thing comes in front of LED, their will occur a reflection. Collecting these reflected waves through photodiode will change the collector voltage of it.
By counting the nos. of photodiode whose collector voltage as changed you can judge the no. of vehicle at that particular path.
The other tedious method what has been employed on the London Street is the counting the speed of the vehicle. If their is no traffic the vehicle will able to travel at high speed compared to moving in the crowded place.
For this they have again used the IR LED - photodiode only, but they also measure after how much time the second photodiode placed at some distance gets change in its state after the first one has changed.