Method and system for detecting traffic lights