Access MinFeretCoordinates data in regionprop table

조회 수: 2 (최근 30일)
Ely Raz
Ely Raz 2023년 11월 26일
편집: Ely Raz 2023년 11월 26일
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}

채택된 답변

Matt J
Matt J 2023년 11월 26일
편집: Matt J 2023년 11월 26일
For example,
stats{1,'MinFeretCoordinates'}
stats{2,'MinFeretCoordinates'}
stats{3,'MinFeretCoordinates'}
  댓글 수: 2
Ely Raz
Ely Raz 2023년 11월 26일
편집: Ely Raz 2023년 11월 26일
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 2023년 11월 26일
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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2023년 11월 26일
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-')

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by