How can i find the Majoraxislength and Minoraxislength of each cell present in binary image ?
6 ビュー (過去 30 日間)
表示 古いコメント
採用された回答
Jonas
2022 年 11 月 29 日
編集済み: Jonas
2022 年 11 月 29 日
a call to regionprops should suffice:
clear;
im=imread("image.png");
im=rgb2gray(im); % to grayscale
im=im~=0; % make binary image
imshow(im)
stats = regionprops('table',im,'Centroid','MajorAxisLength','MinorAxisLength');
% check if the results make sence
centers = stats.Centroid;
diametersMax = max([stats.MajorAxisLength stats.MinorAxisLength],[],2);
diametersMin = min([stats.MajorAxisLength stats.MinorAxisLength],[],2);
radiiMax = diametersMax/2;
radiiMin = diametersMin/2;
hold on
viscircles(centers,radiiMax,'Color','red');
viscircles(centers,radiiMin,'Color','blue');
hold off
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!