Gravar-mail: An Adaptive Track Segmentation Algorithm for a Railway Intrusion Detection System