Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

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.

mn=bwmorph(y,'branchpoints');
[row column] = find(mn);
branchPts    = [row column];
endImg    = bwmorph(y, 'endpoints');
[row column] = find(endImg);
endPts       = [row column];
figure;imshow(y);
hold on ; 
plot(branchPts(:,2),branchPts(:,1),'rx');
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
vislabels(branchesLabeled);
% Calculation of Length of Branches and Circular Neighbourhood Method for
% for detection of normal and abnormal branches.
sts = regionprops( branchesLabeled,'Area', 'Perimeter','MajorAxisLength','Centroid' );
figure
imshow(branchesLabeled)
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);
end 
share|improve this question

migrated from stackoverflow.com Jan 24 '13 at 15:04

This question came from our site for professional and enthusiast programmers.

    
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. –  mmgp Jan 24 '13 at 15:18
    
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. –  user1984451 Jan 24 '13 at 17:07
    
may i take your code to detect branchpoints, endpoints and label image using BWMorph, BWLabel? thanks for ur respon :) –  user9045 May 28 at 2:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.