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