How can i find the Majoraxislength and Minoraxislength of each cell present in binary image ?

6 ビュー (過去 30 日間)

採用された回答

Jonas
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
  4 件のコメント
Shri.s
Shri.s 2022 年 11 月 30 日
okkk sir thanku....

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by