Line and box detection