バイナリ画像における水平方向の白領域の広がりを測定したいです。
5 ビュー (過去 30 日間)
古いコメントを表示
人が片足立ちをし、バランスをとる様子を撮影した動画から人体領域を抽出します。そこから手足の広がりを見るために、バイナリ画像の人体領域における水平方向の幅を測定したいのですが、よいプログラムが思いつきません。
%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
0 件のコメント
採用された回答
Akira Agata
2022 年 10 月 24 日
編集済み: Akira Agata
2022 年 10 月 24 日
regionprops で重心を計算する際に、あわせて Bounding Box を計算しておいて、そのボックスの幅を「体領域における水平方向の幅」と見なせないでしょうか?
% 重心の描写
% s = regionprops(binary1,'centroid'); % <- 元のプログラム
s = regionprops(binary1, {'Centroid', 'BoundingBox'}); % <- BoundingBoxをあわせて計算
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で 単一カメラとステレオ カメラのキャリブレーション についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!