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

5 Ansichten (letzte 30 Tage)
慶次郎 釜堀
慶次郎 釜堀 am 24 Okt. 2022
Bearbeitet: Akira Agata am 24 Okt. 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

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu 単一カメラとステレオ カメラのキャリブレーション finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!