Elastic tracking and neural network algorithms for complex pattern recognition