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

조회 수: 4 (최근 30일)
慶次郎 釜堀
慶次郎 釜堀 2022년 1월 20일
댓글: 慶次郎 釜堀 2022년 1월 20일
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

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 イメージ에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!