Face Detection using Webcam run your code recusrsively.

2 ビュー (過去 30 日間)
irtiza
irtiza 2014 年 2 月 23 日
回答済み: irtiza 2014 年 2 月 23 日
Hi I am implementing face detection in a live video feed.Now my code runs perfect when i debug it it is just when i actually run it does not show my imshow() function i-e nothing figure is not shown but my webcam is running(The light is on).
if true
FDetect = vision.CascadeObjectDetector;
x=0;
vidDevice = imaq.VideoDevice('winvideo', 1, 'YUY2_640x480', ... % Acquire input video stream
'ROI', [1 1 640 480], ...
'ReturnedColorSpace', 'rgb');
while(x<1)
rgbFrame=step(vidDevice);
BB = step(FDetect,rgbFrame);
imshow(rgbFrame);hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','r');
end
hold off
end
end

採用された回答

Image Analyst
Image Analyst 2014 年 2 月 23 日
You probably are showing the image to the current axes and as soon as the next frame from the web cam is available, it overwrites your image. Try using imshow with the 'Parent' option to display the image in a different axes than the live video is showing in.
  2 件のコメント
irtiza
irtiza 2014 年 2 月 23 日
編集済み: irtiza 2014 年 2 月 23 日
First thanks for the answer. But i am not sure what will be my 3 argument i-e the axis using the code mentioned. Since i have not given any reference to the axis and i am not sure at all about this axis concept?. I have tried passing just simply a variable but obviously it wont help.? I have also tried using some update functions my idea was to update the figure but obviously to no effect :(.
irtiza
irtiza 2014 年 2 月 23 日
Hi I have just solved it myself.Thanks a lot for the help, so for the record if any one stumbles upon the same problem i solved it using the drawnow() method just above my imshow call. So basically it updates the figure just like ('image analyst') mentioned. Thanks anyways

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

その他の回答 (1 件)

irtiza
irtiza 2014 年 2 月 23 日
Hi I have just solved it myself.Thanks a lot for the help, so for the record if any one stumbles upon the same problem i solved it using the drawnow() method just above my imshow call. So basically it updates the figure just like ('image analyst') mentioned.
if true
drawnow
imshow(video);
end

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by