skeletonization and ridge detection; Find ends of the skeleton;
Show older comments
Hi, I am trying to skeletonize images of filamentous structures; ideally I would like to obtain single picture width ridges with two ends. Of course, because of noise I get gaps and multiple branches. I want to fill the gaps and prune the branches. For this I need to find the ends of the skleton, branch points and isolated pixels. All those function are well supported by matlab, e.g. morphological operations or applylut. Yet, I spend many hours and didn't succided. Here is piece of the code for visualization:
E = bwmorph(im2skel, 'endpoints'); % im2skel is a skeletonized image
[re,ce] = find(E);
figure;
imshowpair(im2skel,E,'Scaling','independent');
hold on;
plot(ce,re,'.r','MarkerSize',15)
And this is a small subregion of the image:

My point is, that not all of the 'filaments' have two ends! Also, I would expect that each red dot will coincide with white pixel, is it a problem withy matlab visualization? I get exactly the same output using pice of code suggested by Steve on his blogg:
endpoint_fcn = @(nhood) (nhood(2,2) ~= 0) && (sum(nhood(:)) == 2);
endpoint_lut = makelut(endpoint_fcn, 3);
E = applylut(im2skel, endpoint_lut);
Here is other region of the same image:

It must be very simple, why I see isoletd red dot, which does not coincide with any pixel in the E image; Anyway, this other example shows long fiber, which is fragmented and I aim on reconecting it. I tried range of morphological operation, but I didn't succided on the large scale. Other way would be to use endpoints, but as I am showing, I do not get endpoints of all the fragments. First question: Do you have any suggestion why bwmorph(BW, 'endpoints') does not work in my situation? Second question: Can you suggest morphological operations to reconect fragments of the fiber, with certain threshold distance between ends ( e.g. up to 5 pixels)? Many thanks for any suggestions!
Answers (0)
Categories
Find more on Morphological Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!