Contour Recognition using a System of Springs & Charges

The project goal is to recognize the contour of a shape by implementing an algorithm which simulates the behavior of a physical system of springs & charges.

Abstract
The project goal is to recognize the contour of a shape by implementing an algorithm which simulates the behavior of a physical system of springs & charges. A given shape is compared to a few shapes in memory, and the best match is found by minimum energy.
 
The algorithm
The contour of a shape is represented by a number of charges connected to each other with springs.
A given shape is compared to a few shapes in memory to determine the one which it most resembles.
The comparison is done by simulating the attraction of the charges of one shape to the charges of the other shape.
When the system of charges is stabilized, the energy of the springs is calculated. The shape which results in the minimum energy is chosen.
 
The algorithm was implemented with a Matlab program. The contour of each shape was described with 12 points. Each point is simulated with a charge.
In each iteration, the shape is compared to a constant shape in memory.

Representing the contour of a shape:

1
 
A shape matched against a shape in memory:

2 3
 
Initial state                                                                              Final state 
green – shape being compared.                                           The green shape is bent to fit the shape from memory 
red – shape from memory
 
When the shape is stabilized, the energy of its springs is calculated:
4
 
The shape which gives the minimum energy is selected.
 
Results
A few shapes were tested against shapes in memory:
5
 
The minimum energy was found for the best correlation between the two shapes being compared.
 
Conclusion
Contour recognition using a simple system of springs & charges gave good results.
We found the algorithm was only working when the two shapes were centerized.