Automatic Traffic Light for Pedestrians

Every day, people cross roads, on their way to work, home or other places. Some crossroads are placed at dangerous sites where the driver can't see the crossroad from safe distance.

Every day, people cross roads, on their way to work, home or other places.
Some crossroads are placed at dangerous sites where the driver can’t see
the crossroad from safe distance. When he finally notices a pedestrian,
there isn’t enough time to stop the car safely. Also pedestrians may not
be able to have a safe view of the road in order to recognize approaching
vehicles in time.

In this project we suggest a simple algorithm for automatic recognition
of pedistrians and approaching vehicles based on motion detection.

The problem

The project’s goal is to establish an automatic system for displaying
a warning to drivers/pedestrians when a dangerous situation at a crossroad
is recognized.
The aim is to enable the driver/pedestrian to take action before it is
too late, i.e. stop the car safely or cross the road safely.
The algorithm shall use minimal computational recources in order to ready
for real-time implementation.

The solution
Our system is based on differentiation of each frame from a pre-captured
background and on calculating motion vectors in the relevant areas.

Algorithm’s Main Steps

1. User defined inputs:

  • Maximum allowed speed
  • ‘Safety distance’ for car movement (see report)
  • Relevant area for recognition of approaching vehicle
  • Cars movement direction
  • Crossroad area
  • Pedestrians movement direction.
  • Background Image

2. Loading frame.
3. Searching for suspicious objects (cars, pedestrians) in the relevant
4. If there are no suspicious objects-load the next frame.
5. If a suspicious object was recognized – load concurrent frame and calculate
the motion relative to concurrent frame.
6. If motion is above a predefined threshold – display warning message,
if not return to start.

Recognition of suspicious objects

  • Make a difference image (Current frame- Background).
  • Multiply the difference image, element wise, with the relevant mask.
  • Sum the elements at the resulting image.
  • If the sum is above predefined threshold -there is a suspicious object.
  • If there is a suspicious object, take another frame according to operators

Parameters for motion vector block (Simulink)

  • Search method- three steps.
  • Block matching criteria- MSE.
  • Block size- [25, 25].
  • Maximum displacement- [7, 7].
  • Velocity output- complex number.

Other details

  • Elements whose direction is not according to the operator’s inputs
    are eliminated.
  • For calculation of object’s overall motion the length of all its motion
    vectors is summed.



  • Digital camera Sony┬« DCR-PC110E


  • MATLAB 2006b (algorithm) and SIMULINK (motion vector calculation)




Figure 1 – The Algorithm finds a car
comming and show a message for the user .


Figure 2 – The Algorithm finds a pedestrian comming and show a message for the user .


Some conclusions and future directions :

  • Influence of camera location.
  • Size of Block Matching block.
  • Clearance between frames for calculating motion vectors.
  • Finding direction of motion at other directions.
  • Speed of the algorithm.
  • Adaptive background reference picture.
  • Summing magnitude of complex numbers of the motion vector.
  • Summing nearst pixels, determine threshold for new object.
  • One object \ two objects detection.


We are grateful to our supervisor Johanan Erez for his help and guidance
throughout this work.
We are also grateful to the Ollendorff
Minerva Center
Fund for supporting this project.