Method and system for recognising someone taking part in traffic and for generating an alarm