# Detect quasi-parallel lines with spurs in a binary image

I'm looking for a way to remove quasi-parallel curves from the net, as depicted in the figure. Not only the original nets (upper row in figure) contain many spurs, but also the curves to be detected are not necessary straight lines. Ideally, I'd like to keep only the border of each such a region (lower row in figure).

I've came across solutions like hit-or-miss with line structuring element, Hough transform and Radon transform - but they were aimed at either detecting long straight lines or arbitrary shapes (like ellipses).

My idea was to represent a net as a graph, linearly approximate each edge (and split it into smaller segments if it deviates from the approximated line too much), for each pixel store the slope of an approximated edge in a matrix, and finally for each pixel I'd search such a matrix in a given neighborhood for other pixels (belonging to a different edge) with a similar slope.

Could you recommend me any method already used to accomplish such a task or tell me whether my approach seems reasonable?

## 1 Answer

I would start with a pruning algorithm (see skeleton pruning) in order to erase small segments, then use:

• the Hough transform, but segments are not really straights.
• if the pruning was a success, then you separate each segment and use the first and last point to compute the orientation, which will define when line are parallel. You will have to introduce a tolerance because you want quasi-parallel lines.