Reputation: 85
I am currently using the bwconncomp
function like so:
CC = bwconncomp(BW);
BW
is an input binary image. CC
is a structure with four fields. bwconncomp
labels each object in an image.now i want to find major axis and minor axis of each object i have tried using regionprops
but not getting results.
here is my code
inimage = imread('Capture.PNG');
subplot(2,2,1);
imshow(inimage);
title('original image');
BW=im2bw(inimage);
subplot(2,3,3);
imshow(BW);
title('binary image');
The relevant code:
CC = bwconncomp(BW);
stats = regionprops('table',BW,'Centroid','MajorAxisLength','MinorAxisLength')
Upvotes: 0
Views: 1715
Reputation: 114786
Try
LB = bwlabel( BW ); %// label the components in the image
stats = regionprops(LB,'Centroid','MajorAxisLength','MinorAxisLength');
Upvotes: 4