for文の中にfig​ureを3つ入れてい​るのですが、毎回新し​いウィンドウで出てし​まいます。ウィンドウ​を固定したいです。

4 views (last 30 days)
慶次郎 釜堀
慶次郎 釜堀 on 20 Jan 2022
Commented: 慶次郎 釜堀 on 20 Jan 2022
for i=1:filenumber
%画像の読み込み
I = imread([path sprintf('%04d.jpg',i)]);
%画像のサイズ変更
FG = imresize(I,bairitu);
sourceimage = imresize(I,bairitu);
%鮮鋭化
FG = imsharpen(FG);
%背景差分
FG1 = imabsdiff(BG1,FG);
%グレースケール変換
G = rgb2gray(FG1);
%2値化
FG2 = imbinarize(G);
%FG2 = G>20;
%morph
SE = strel('disk',15,0);
FG3 = imclose(FG2,SE);
imshow(FG3);
%bwareaope
FG4 = bwareaopen(FG3,300);
%人体領域にバウンディングボックス
s0 = regionprops(FG4,'BoundingBox');
s1 = s0.BoundingBox;
%足領域を抽出
FG4 = imcrop(FG4,[s1(1,1) s1(1,2)+s1(1,4)*0.5 s1(1,3) s1(1,4)*0.5]);
%手のノイズ除去
FG5 = bwareaopen(FG4,300);
%背景画像にも適用
sourceimage_foot = imcrop(sourceimage,[s1(1,1) s1(1,2)+s1(1,4)*0.5 s1(1,3) s1(1,4)*0.5]);
%足領域にバウンディングボックス
s2 = regionprops(FG5,'BoundingBox');
s3 = s2.BoundingBox;
s3(1,5) = l;
s3(1,6) = m;
s3(1,7) = n;
point(i,:) = s3;
point = round(point);
bbox_result = insertShape(sourceimage_foot,'Rectangle',[point(i,1:4)],'LineWidth',3);
imshow(bbox_result);
figure,imshow(FG3);
figure,imshow(FG4);
figure,imshow(FG5);
end

Accepted Answer

Shunichi Kusano
Shunichi Kusano on 20 Jan 2022
figure(1), imshow(FG3);
figure(2), imshow(FG4);
figure(3), imshow(FG5);
とID指定してしまえば大丈夫です。
  1 Comment
慶次郎 釜堀
慶次郎 釜堀 on 20 Jan 2022
できました!ありがとうございます。

Sign in to comment.

More Answers (0)

Categories

Find more on イメージ in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!