Count the endpoints in a image

How to count the number of endpoints as marked in this image.
I tried with bwmorph(endpoints). But my output is like this.

5 件のコメント

Rik
Rik 2020 年 10 月 14 日
What exact code steps did you use?
Malini
Malini 2020 年 10 月 14 日
I= imread('Endpoints.png');
B= I(:,:,3);
E= bwmorph(B,'Endpoints');
figure,imshow(E);
Rik
Rik 2020 年 10 月 14 日
編集済み: Rik 2020 年 10 月 14 日
This time I edited your post for you. Next time, please use the tools explained on this page to make your question more readable.
If you read the documentation you see that it is meant to be run on a skeletonized image, so you need to do that first.
I= imread('Endpoints.png');
B= I(:,:,3)>128;
S= bwmorph(B,'skel');
E= bwmorph(S,'endpoints');
figure,imshow(E);
Malini
Malini 2020 年 10 月 14 日
Sure. Will follow the documentation.
Thank you so much. I got it after the skeletonization for that image.
And I followed the same for this image which I didnt get because the skeletonized image is not continuous. How to fix that. Attached the code I used for this image.
I = imread('Onion.png');
mask = I(:,:,1)<I(:,:,2) & I(:,:,3)<I(:,:,2);
skel = bwmorph(mask,'skel',Inf);
figure,imshow(skel);
E = bwmorph(skel, 'endpoints');
Rik
Rik 2020 年 10 月 14 日
You could try imclose to close the gaps and smoothen your mask. Another possibility is to modify your initial mask creation.
Side note: if you want help with your specific images you will have to attach the originals.

サインインしてコメントする。

回答 (0 件)

タグ

質問済み:

2020 年 10 月 14 日

コメント済み:

Rik
2020 年 10 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by