Azzera filtri
Azzera filtri

Access MinFeretCoordinates data in regionprop table

1 visualizzazione (ultimi 30 giorni)
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}

Risposta accettata

Matt J
Matt J il 26 Nov 2023
Modificato: Matt J il 26 Nov 2023
For example,
stats{1,'MinFeretCoordinates'}
stats{2,'MinFeretCoordinates'}
stats{3,'MinFeretCoordinates'}
  2 Commenti
Ely Raz
Ely Raz il 26 Nov 2023
Modificato: Ely Raz il 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 il 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

Accedi per commentare.

Più risposte (1)

Walter Roberson
Walter Roberson il 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-')

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by