MATLAB Answers

0

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

Asked by Edwin Sun on 23 Jan 2019 at 4:11
Latest activity Commented on by Edwin Sun on 29 Jan 2019 at 6:49
Hi,
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?
filteredIm=thinedImage&~bp;
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.

  2 Comments

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.
Thanks

Sign in to comment.

0 Answers