I have a skeleton image. I am able to detect branchpoints, endpoints and able to label image using BWMorph, BWLabel. Now I want to differntiate between skeleton center line and branches. In short I want to detect branches in skeleton. I want to perform operations on skeleton branches and I do not want to consider center line in these operations. Can someone help? Following is skeleton image. http://www.flickr.com/photos/92388309@N03/8397759970/in/photostream/ Arrows in following image show center line of skeleton. http://www.flickr.com/photos/92388309@N03/8404495186/in/photostream/

Following is code I have used.

[row column] = find(mn);
branchPts    = [row column];
endImg    = bwmorph(y, 'endpoints');
[row column] = find(endImg);
endPts       = [row column];
hold on ; 
hold on; plot(endPts(:,2),endPts(:,1),'*');
% Labeling the Branches
branches = imsubtract(y,mn); % set branch points to zero
figure; imshow(branches);title('no bp')
branchesLabeled = bwlabel( branches); % label connected components
% Calculation of Length of Branches and Circular Neighbourhood Method for
% for detection of normal and abnormal branches.
sts = regionprops( branchesLabeled,'Area', 'Perimeter','MajorAxisLength','Centroid' );
hold on
% Loop for circles
for i=1:size(sts)
r= sts(i).MajorAxisLength/2 ; %desired radius
centerx = sts(i).Centroid(1);  
centery = sts(i).Centroid(2);
th = 0:pi/50:2*pi;
xunit = r * cos(th) + centerx;
yunit = r * sin(th) + centery;
plot(xunit, yunit);
  • $\begingroup$ What are these operations on the skeleton that you want to perform ? It might be possible to recover the main branches in its entirety after you perform these operations. $\endgroup$
    – mmgp
    Commented Jan 24, 2013 at 15:18
  • $\begingroup$ Thank you for your reply. I want to draw circle on each branch with branch lengh/2 as a redius. And I do not want circle on the center line of skeleton. $\endgroup$ Commented Jan 24, 2013 at 17:07
  • $\begingroup$ may i take your code to detect branchpoints, endpoints and label image using BWMorph, BWLabel? thanks for ur respon :) $\endgroup$
    – user9045
    Commented May 28, 2014 at 2:18

1 Answer 1


You may use the same technique I used in Detect Longest Vertical Lines (Edges) in an Image to locate the center line under the assumption it is the longest.

Once you find it, it is easy to locate branches.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.