バイナリ画像における​水平方向の白領域の広​がりを測定したいです​。

2 vues (au cours des 30 derniers jours)
慶次郎 釜堀
慶次郎 釜堀 le 24 Oct 2022
Modifié(e) : Akira Agata le 24 Oct 2022
人が片足立ちをし、バランスをとる様子を撮影した動画から人体領域を抽出します。そこから手足の広がりを見るために、バイナリ画像の人体領域における水平方向の幅を測定したいのですが、よいプログラムが思いつきません。
%3Dカメラで撮影したので、3次元データを読み込んでいます。
load('C:\Users\thithilab\Desktop\釜堀\Intel RealSense SDK 2.0\matlab\2022\09\13\16\MAT\2022_09_13_164718.mat');
i = 1;
number=600;
%設定
result = zeros(120,212,number);
centroid_data = zeros(number,2);
for i = 1:number
A = Depth_Data(:,:,i);
%背景差分
diff = imabsdiff(A,background);
%閾値処理・二値化
binary = diff>900;
%ノイズ除去
binary1 = bwareaopen(binary,500);
%重心の描写
s = regionprops(binary1,'centroid');
centroids = cat(1,s.Centroid);
%重心データの格納
centroid_data(i,:) = centroids;
imshow(binary1)
hold on
plot(centroids(:,1),centroids(:,2),'r.')
hold off
drawnow;
end

Réponse acceptée

Akira Agata
Akira Agata le 24 Oct 2022
Modifié(e) : Akira Agata le 24 Oct 2022
regionprops で重心を計算する際に、あわせて Bounding Box を計算しておいて、そのボックスの幅を「体領域における水平方向の幅」と見なせないでしょうか?
% 重心の描写
% s = regionprops(binary1,'centroid'); % <- 元のプログラム
s = regionprops(binary1, {'Centroid', 'BoundingBox'}); % <- BoundingBoxをあわせて計算

Plus de réponses (0)

Catégories

En savoir plus sur 単一カメラとステレオ カメラのキャリブレーション dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!