edgeSnap function, snaps given line to edges in image