Crowd motion segmentation and anomaly detection via multi-label optimization