Smart Line detection on metal and glass