An Energy based Method to Measure the Crowd Safety