필터 지우기
필터 지우기

How to find length of branch in a skeleton image?

조회 수: 24 (최근 30일)
Kirti
Kirti 2013년 3월 14일
I have skeleton image as shown in following link. I have to find the length of branch or branches in a skeleton image. I have tried bwtraceboundry function for checking the connectivity but i did not get the any value. Also, i have tried using repmat as follows d = [ 1 0; -1 0; 1 1; 0 1; -1 1; 1 -1; 0 -1; -1 -1]; Then the neighbors of location loc =[i j] are neighbors = d+repmat(loc,[8 1]); for finding neighbours of a pixels. 'neighbors' giving me 8 pixel coordinates. But i want to check connectivity of white line for finding branch length. image link: http://www.flickr.com/photos/92388309@N03/8555556765/in/photostream
Can any one help me in this.

답변 (2개)

Teja Muppirala
Teja Muppirala 2013년 3월 14일
You can first find the branch points and endpoints using BWMORPH, and then call BWDISTGEODESIC to get the distance from the branches. Assuming your image is binary and called "I", this is all it takes:
It = bwmorph(I,'thin','inf');
B = bwmorph(It,'branchpoints');
[i,j] = find(bwmorph(It,'endpoints'));
D = bwdistgeodesic(It,find(B),'quasi');
imshow(I);
for n = 1:numel(i)
text(j(n),i(n),[num2str(D(i(n),j(n)))],'color','g');
end
  댓글 수: 1
Kirti
Kirti 2013년 3월 14일
Thank you for your reply. I am using MatLab 7.9.0(R2009b)and bwdistgeodesic is not available. Can we do that without using function, just by checking connectivity from end point to branch point.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2013년 3월 14일
Find the branchpoints using bwmorph. Then subtract that image from the original to get disconnected branches. Then call regionprops(binaryImage, 'area') to get the length of all the branches.
  댓글 수: 3
Image Analyst
Image Analyst 2013년 3월 14일
편집: Image Analyst 2013년 3월 14일
Yes it does. If you want to disconnect only short branches then you need to look at the angle to reconnect longer branches that became disconnected/broken. Do a web search on "edge linking". http://www.csse.uwa.edu.au/~pk/Research/MatlabFns/#edgelink
Cedric
Cedric 2013년 3월 14일
Thank you for the link, this seems to be a great resource!

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by