videoinput error in real time detection

5 ビュー (過去 30 日間)
Nachiket Patki
Nachiket Patki 2017 年 5 月 1 日
回答済み: Ashiq Ullah 2019 年 1 月 22 日
Hello sir, While I was working on real time face detection I got this error when I run my code for the second time. I have written stop(vid) and clear (vid) at the end of script,still I am getting this following error.
"winvideo: The device associated with device ID 1 is already in use. A new videoinput object cannot be created for this device while it is in use."
Can you tell me how to get rid of this? Thank you
  2 件のコメント
Nachiket Patki
Nachiket Patki 2017 年 5 月 2 日
編集済み: Walter Roberson 2017 年 5 月 2 日
my code is here:
vid = videoinput('winvideo',1,'YUY2_640x480');
triggerconfig(vid ,'manual');
set(vid, 'TriggerRepeat',inf);
set(vid, 'FramesPerTrigger',1);
vid.ReturnedColorspace = 'rgb';
vid.Timeout = 6;
start(vid);
while(1)
facedetector = vision.CascadeObjectDetector;
trigger(vid);
img = getdata(vid, 1);
bbox = step(facedetector, img);
hello = insertObjectAnnotation(img,'rectangle',bbox,'Face');
imshow(hello);
imwrite(img(bbox(2):bbox(2)+bbox(4),bbox(1):bbox(1)+bbox(3)),'Faceimage.jpg')
end
stop(vid),clear vid
Nachiket Patki
Nachiket Patki 2017 年 5 月 5 日
Also, why the face detection process is in general very slow, can you please tell me what must the reason for this? Because I tried code in python but its comparatively very fast. Thank you

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

回答 (1 件)

Ashiq Ullah
Ashiq Ullah 2019 年 1 月 22 日
Use this method:
>>objects = imaqfind ;
>> delete(objects) ;

Community Treasure Hunt

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

Start Hunting!

Translated by