Effacer les filtres
Effacer les filtres

Access MinFeretCoordinates data in regionprop table

2 vues (au cours des 30 derniers jours)
Ely Raz
Ely Raz le 26 Nov 2023
Modifié(e) : Ely Raz le 26 Nov 2023
How can I access each circle MinFeretCoordinates?
clc;
clear;
a = imread("circlesBrightDark.png");
bw = a < 50;
imshow(bw)
title("Image with Circles")
stats = regionprops("table",bw,"Centroid","MinFeretProperties", "MajorAxisLength","MinorAxisLength")
stats = 3×6 table
Centroid MajorAxisLength MinorAxisLength MinFeretDiameter MinFeretAngle MinFeretCoordinates ________________ _______________ _______________ ________________ _____________ ___________________ 300 120 79.517 79.517 79 -90 {2×2 double} 330.29 369.92 109.49 108.6 108 0 {2×2 double} 450 240 99.465 99.465 99 -90 {2×2 double}

Réponse acceptée

Matt J
Matt J le 26 Nov 2023
Modifié(e) : Matt J le 26 Nov 2023
For example,
stats{1,'MinFeretCoordinates'}
stats{2,'MinFeretCoordinates'}
stats{3,'MinFeretCoordinates'}
  2 commentaires
Ely Raz
Ely Raz le 26 Nov 2023
Modifié(e) : Ely Raz le 26 Nov 2023
Thanks. How I can I get an access to the 4 numbers in each cell content {2×2 double}? they are all in one cell (1×1 cell array)
c1 = stats{1,'MinFeretCoordinates'}
Matt J
Matt J le 26 Nov 2023
The same as any other cell, e.g.,
a = imread("circlesBrightDark.png");
bw = a < 50;
stats = regionprops("table",bw,"Centroid","MinFeretProperties",...
"MajorAxisLength","MinorAxisLength");
fourNumbers = stats{1,6}{1}
fourNumbers = 2×2
307.5000 80.5000 307.5000 159.5000

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 26 Nov 2023
a = imread("circlesBrightDark.png");
bw = a < 50;
imshow(bw)
title("Image with Circles")
stats = regionprops("table",bw,"Centroid","MinFeretProperties", "MajorAxisLength","MinorAxisLength")
stats = 3×6 table
Centroid MajorAxisLength MinorAxisLength MinFeretDiameter MinFeretAngle MinFeretCoordinates ________________ _______________ _______________ ________________ _____________ ___________________ 300 120 79.517 79.517 79 -90 {2×2 double} 330.29 369.92 109.49 108.6 108 0 {2×2 double} 450 240 99.465 99.465 99 -90 {2×2 double}
%then
MFC = cat(3,stats.MinFeretCoordinates{:});
The result would be a 2 x 2 x N numeric array where N is the number of regions detected.
hold on; plot(squeeze(MFC(:,1,:)), squeeze(MFC(:,2,:)), 'r-')

Catégories

En savoir plus sur Import, Export, and Conversion dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by