A Real Time Visual Inspection System for Railway Maintenance: Automatic Rail Detection and Tracking