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

조회 수: 1 (최근 30일)
慶次郎 釜堀
慶次郎 釜堀 2022년 10월 24일
편집: Akira Agata 2022년 10월 24일
人が片足立ちをし、バランスをとる様子を撮影した動画から人体領域を抽出します。そこから手足の広がりを見るために、バイナリ画像の人体領域における水平方向の幅を測定したいのですが、よいプログラムが思いつきません。
%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

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 単一カメラとステレオ カメラのキャリブレーション에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!