How can I reduce delay when using timer for capturing 'video' from webcam?
显示 更早的评论
I am trying to make some sort of game which involves the use of the webcam - and i need to get live feed from the webcam - process some of the frames and also display the video I recieve (with some added plots on the image therefore preview is not an option, also i need to flip the image...).
My thought was that if I'll use timed snapshots (using timer) I will recieve a steady fps displayed and will not have to worry about my processing taking long time, but in practice I found out that even with no processing at all - only displaying the images and plotting using timer the program generates a delay.
At the first few seconds it is not noticable but after 10 seconds there is a slight delay, and waiting 10 minutes cause a delay of a second or more.
Anyway my setup for the timer was:
StartDelay 2, Period 0.05-0.3 (tried some values in this range)
ExecutionMode- tried all of them but thought fixedRate should be the best for a steady fps.
BusyMode - drop.
some StartFcn, and a not to heavy to process TimerFcn.
also I was trying to pass a complex structure of data using the UserData field, including the camera, and some state field for the display options.
Would really appreciate some help on this - I haven't found anyone using this method - maybe I was wrong to use it in the first place.
Also, I would like to know if there is a better way to process live feed images and display them other then loop snapshots.
Thanks for the help.
2 个评论
Geoff Hayes
2020-2-14
Ron - are you saying that the longer you run your app, the greater the delay in displaying the image (from the webcam)? Could you share a small sample of your code (that demonstrates this behaviour) and in particular, your timer callback?
Ron Sofer
2020-2-15
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Motion Detection 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!