MATLAB Answers

I just need to draw that line inside these objects. This line should aproximate these

1 view (last 30 days)
adrian satmari
adrian satmari on 7 Feb 2020
Commented: Guillaume on 10 Feb 2020
- I delimited this image in 7 objects
-I don't know how should i determine these points to make that green line from the picture

  0 Comments

Sign in to comment.

Answers (2)

Guillaume
Guillaume on 7 Feb 2020
Maybe
skeleton = bwskel(imclose(yourimage, strel('diamond', 2)))

  3 Comments

adrian satmari
adrian satmari on 9 Feb 2020
Hmm, thank you @Guillaume!
but, this method is not recognized by Matlab. :( "bwskel"
imshow(BW);hold on;figure
skeleton = bwskel(imclose(BW, strel('diamond', 2)))
imshow(skeleton)
Guillaume
Guillaume on 10 Feb 2020
You can use
skeleton = bwmorph(imclose(BW, strel('diamond', 2)), 'skel', Inf);
To get similar (but not identical) results to bwskel. bwskel is an improved version and indeed you'll have to upgrade if you want to use it.

Sign in to comment.


Image Analyst
Image Analyst on 7 Feb 2020
Try
binaryImage = imfill(binaryImage, 'holes');
skelImage = bwmorph(binaryImage, 'skel', inf);

  4 Comments

Show 1 older comment
Image Analyst
Image Analyst on 9 Feb 2020
Unfortunately MATLAB does not have a "longest spine" function. You can use bwmorph() with the 'spur' option but it won't be exactly what you'd want. Contact the Mathworks and ask them for the longest spine option. I've been asking them for years for it.
adrian satmari
adrian satmari on 10 Feb 2020
Thank you again!
I want to mesure this angles, beween the main spine and Y axe,
and for this I tried to aprox. these spines.
I tried with regionprops -> Orienation too, but I think is not helpful.
line - Copy.png
Guillaume
Guillaume on 10 Feb 2020
Well, you really need to upgrade!
The bwskel I suggested has an optional input, MinBranchLength which would allow you to trim the skeleton to the main trunk. From then on, the 'Orientation' of regionprops would be a lot more accurate. Unfortunately, bwmorph doesn't have the same option.

Sign in to comment.

Sign in to answer this question.


Translated by