Trajectories obtained from low level tracking algorithm provide an opportunity for us to analyze meaningful behaviors and monitor adverse or malicious events. How to abstract meaningful features from the raw data of trajectories is a challenge due to the high dimensionality and noise. In this paper, a novel approach, stacked denoising autoencoder(SDA) is applied to address this problem. This method can reduce the dimensionality of the trajectories significantly, so that they can be handled easily. More importantly, the denoising process of the SDA can capture the structure of the raw data, so the features they producing generalize well for detecting anomalous trajectories. The results of the numerical experiments prove the validity of the proposed approach.