Access MinFeretCoordinates data in regionprop table

2 visualizaciones (últimos 30 días)
Ely Raz
Ely Raz el 26 de Nov. de 2023
Editada: Ely Raz el 26 de Nov. de 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}

Respuesta aceptada

Matt J
Matt J el 26 de Nov. de 2023
Editada: Matt J el 26 de Nov. de 2023
For example,
stats{1,'MinFeretCoordinates'}
stats{2,'MinFeretCoordinates'}
stats{3,'MinFeretCoordinates'}
  2 comentarios
Ely Raz
Ely Raz el 26 de Nov. de 2023
Editada: Ely Raz el 26 de Nov. de 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 el 26 de Nov. de 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

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 26 de Nov. de 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-')

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by