peekdata help

6 ビュー (過去 30 日間)
Oliver
Oliver 2012 年 3 月 11 日
Hi folks,
I'm having a bit of trouble with peekdata.
I have a video object created called 'vid',
I'm using
triggerconfig(vid,'manual');
start(vid);
RGBData = peekdata(vid,1);
This works fine, I get a 3d array in RGBData. But it only works in debug mode. As soon as I run it from the GUI I get...
"Warning: PEEKDATA could not return all the frames requested."
and RGBData is now empty... I can't understand why it works in debug but not when running normally.
thanks in advance, this is driving me nuts. Ollie
p.s. i'm trying to gather frames from a webcam indefinitely, is there's a better way to go about it?

回答 (3 件)

Walter Roberson
Walter Roberson 2012 年 3 月 11 日
Possibly there simply has not been enough time for the data to arrive. Try adding a small pause()
  1 件のコメント
Oliver
Oliver 2012 年 3 月 11 日
hi, thanks for your response, i tried adding pause(5) and it still doesn't work.
I set the debug after the line RGBData = peekdata(vid,1);

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


Image Analyst
Image Analyst 2012 年 3 月 11 日
Try getsnapshot() instead. See if that works.

Oliver
Oliver 2012 年 3 月 11 日
Thanks, I tried getsnapshot() but found it to be too slow.
Whilst trying to figure out what was wrong I used a try;catch setup and after a couple of failed calls to peekdata(vid,1) it started working!

Community Treasure Hunt

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

Start Hunting!

Translated by