Edge detection and tracking