Azzera filtri
Azzera filtri

人体領域の二値画像から頭部領域を抽出したいです。

5 visualizzazioni (ultimi 30 giorni)
慶次郎 釜堀
慶次郎 釜堀 il 3 Lug 2023
壁の前で被験者がバランスタスクを行っている様子を3Dカメラで撮影し、人体領域を抽出しました。得られた領域から頭部領域を抽出したいのですが、よいプログラムが思いつきません。
input = zeros(480,640);
centroid_data = zeros(140,2);
BoundingBox_data = zeros(140,4);
for k = 1:145
%インプット
input = data0004(:,:,k);
%人体領域のトリミング
A = imcrop(input,[50,0,550,400]);
%データの反転
A1 = abs(A-5);
%ノイズの除去
for i = 1:400
for j = 1:551
if A1(i,j) == 5
A1(i,j) = 0;
end
end
end
%メディアンフィルタ
A2 = medfilt3(A1);
%閾値による背景差分
BW1 = A2>2.5;
%ノイズ除去
BW2 = bwareaopen(BW1,500);
%モルフォロジー処理
%重心とバウンディングボックスの描写
s = regionprops(BW2, {'Centroid', 'BoundingBox'});
centroids = cat(1,s.Centroid);
BoundingBox = cat(1,s.BoundingBox);
%重心とバウンディングボックスデータの格納
centroid_data(k,:) = centroids(1,:);
BoundingBox_data(k,:) = BoundingBox(1,:);
point = round(BoundingBox_data);
imshow(BW2);
hold on
plot(centroids(:,1),centroids(:,2),'r.')
rectangle('Position',[point(k,1:4)],'EdgeColor','y','LineWidth',2)
hold off
% pause(0.05);
% imagesc(BW2)
% impixelinfo
drawnow;
end

Risposte (0)

Categorie

Scopri di più su Convert Image Type in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!