Help eliminating branches from skeleton image

7 views (last 30 days)
I've been tasked with using the image toolbox to find the mid-line of fish. I have found a better implementation of the bwmorph skel() function and now I'm having trouble eliminating the branches (fins) from the mid-line.
This first image depicts the basic usage of the skeleton function.
This second image is the image created after subtracting the dilated branchpoints.
This third image is using bwboundaries in order to differentiate the line segments of picture #2.
My problem lies when using any type of function on my second subtracted image - for some reason the gap that I've eliminated gets filled in and my line gets treated as one or two larger lines. This applies to even bwmorph functions - using h-break,open,close, and even spur (all to test the effects on image #2) seem to bridge the gap between my line segments.
I'm asking for a fix to my gap-filling problem or even a better implementation of eliminating the vertical fins from the main horizontal line.
I've thought about eliminating the fins before taking the skeleton but I've had no luck.This is the image of the fish after cropping and thresholding. Ideally I'd like to eliminate the top and bottom fins from the main body. Are there any suggestions about how to proceed from here?
Thanks in advance.
  2 Comments
Ashish Uthama
Ashish Uthama on 17 Feb 2015
Could you add a full resolution picture of the thresholded fish for folks to potentially try out other approaches?
If all the images are always horizontal, you could try something like whats used here: http://www.mathworks.com/matlabcentral/answers/169443-how-to-follow-the-external-border-of-an-object-in-segmentation#answer_164770
Brian Vu
Brian Vu on 23 Feb 2015
Sorry for getting around to commenting so late - I thought I would receive an e-mail whenever I had any responses. I managed to remove the fins using a prewitt filter along with various morphological operations + area deletions.
Thanks for taking the time to answer.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 11 May 2020
With the new bwskel() function, you can get rid of spurs and get just the longest spine.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!