[HELP] how to close figure automatic

9 ビュー (過去 30 日間)
Cahyo Nugroho
Cahyo Nugroho 2014 年 9 月 3 日
編集済み: Salaheddin Hosseinzadeh 2014 年 9 月 3 日
Hi, i have code that i used to detect face. When there is no face, it must return to the begining of the program. My problem when there is no face in front of the camera, i must close the figure first to make the program continue. This is my code :
clc
clear all
% Initiate input
vid=videoinput('winvideo',2,'RGB24_640X480');
set (vid,'SelectedSourceName','input1');
vid.ReturnedColorSpace='rgb';
vid.FramesPerTrigger=1;
vid.FrameGrabInterval=200;
vid.TimeOut=200;
preview (vid)
global sum_bbox;
global bbox;
global FaceFrame;
global sum_bboxeye;
while (true);
% CAPTURE IMAGE
cla reset
data = getsnapshot(vid);
imwrite(data,'data.jpg');
i = imread('data.jpg');
%FUNGSI FACE DETECTOR
face_detection(i);
[baris1,kolom1]=size(bbox);
if bbox == 0 | baris1>=2
data = getsnapshot(vid);
imwrite(data,'data.jpg');
i = imread('data.jpg');
face_detection(i);
close
else
% BBOX SEGMENTATION
FFrameCrop= imcrop(FaceFrame,bbox);
subplot (3,2,2); imshow(FFrameCrop); title ('subimage faceframe');
pause(1)
end
end
Help me please.. thx b4

回答 (1 件)

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2014 年 9 月 3 日
編集済み: Salaheddin Hosseinzadeh 2014 年 9 月 3 日
Hi Cahyo,
I don't know how experienced are you, using MATLAB, but don't you think you can close the figure using close gca
close gcf
close all
see MATLAB documentation to understand how to close a specific window.
doc close
I'm sorry if it's the wrong answer, just let me know to remove it and someone esle would definitely answer it.
Hope this helps.
Good Luck!
  2 件のコメント
Sean de Wolski
Sean de Wolski 2014 年 9 月 3 日
編集済み: Sean de Wolski 2014 年 9 月 3 日
I think you meant gcf rather than gca
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2014 年 9 月 3 日
編集済み: Salaheddin Hosseinzadeh 2014 年 9 月 3 日
Thanks Sean,
As you mentioned, that should be gcf rather than gca
I'll edit it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by