Can anyone help me to solve this error in regionprops().
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
This is the code.The stats is a table, in that MajorAxisLength() and MinorAxisLength() is showing as 0*0 (double)
gray = imread('CYST RENAL-37.jpg');
grayImage = rgb2gray(gray);
level = graythresh(gray);
BW = imbinarize(gray,level);
stats = regionprops('table',BW,'Centroid',...
'MajorAxisLength','MinorAxisLength');
centers = stats.Centroid;
diameters = mean([stats.MajorAxisLength stats.MinorAxisLength],2);
radii = diameters/2;
Pls help me to solve this error. Any help is appreciated
3 Commenti
Walter Roberson
il 24 Mag 2021
Also I wonder if using "equivalent diameter" property would happen to be appropriate for your case.
Risposte (1)
Walter Roberson
il 25 Mag 2021
gray = imread('CYST RENAL-37.jpg');
grayImage = rgb2gray(gray);
BW = imbinarize(grayImage);
stats = regionprops('table',BW,'Centroid',...
'MajorAxisLength','MinorAxisLength');
centers = stats.Centroid;
diameters = mean([stats.MajorAxisLength stats.MinorAxisLength],2);
radii = diameters/2;
You were trying to imbinarize() the RGB image, not the gray image.
Also, imbinarize() automatically determines the threshold by calling graythresh if you do not pass in a level.
0 Commenti
Vedere anche
Categorie
Scopri di più su Image Segmentation and Analysis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!