MATLAB Answers


How to remove bridged lines/branches between lines in image?

Asked by Edwin Sun on 23 Jan 2019
Latest activity Commented on by Edwin Sun on 29 Jan 2019
I would like to remove certain lines which are not the main parallel lines, that is, all the horizontally connected bridges and spurs.
This is my thinedImage:
I have tried disconnecting the branches by using:
bp=bwlookup(thinedImage, makelut(@(x) sum(x(:))>=4 & x(5)==1,3)); %branch points?
I then try to perform a bwareaopen(filteredIm, 50) and get this:
Basically everything on the left hand side is fine, but I have removed too much from the right hand side. How do I keep the major line, removing only the smaller branches?
I have also tried using
thinedImage - bwmorph(thinedImage, 'spur', Inf);
in the 2nd step, but that doesnt turn out too wel either.


Perhaps use hough() with a range of theta that are close to 0, and then houghlines() to detect lines at those angles?
Sorry, didnt get a chance to test it till now.
The hough transform only fit to certain sections of the line, not the whole line. Basically the output from hough() is a whole bunch of lines which make up the the line. Is there a way for the hough transform to be a bit more lenient?
Also the image in the question is one of the better ones from a set of data, and not all the datas are as straight.. some are a bit more zig zaggy.

Sign in to comment.

0 Answers