Irregular time stamps from web camera
2 views (last 30 days)
Show older comments
Hi, I am trying to do some real time processing and I need to capture frames from my webcamera at 5fps. My webcamera is Logitech (QuickCam Communicate Deluxe (winvideo-1) ). I have captured 30 frames. Here is my code:
vid = videoinput('winvideo', 1, 'RGB24_640x480');
src = getselectedsource(vid);
vid.FramesPerTrigger = 30;
src.FrameRate = '5.0000';
vid.ReturnedColorspace = 'grayscale';
start(vid);
wait(vid,Inf);
numframes = get(vid,'FramesAvailable');
[frames,time] = getdata(vid,numframes);
I would expect that since the frame rate has been set to 5, the time stamps from camera should be regularly spaced at 0.200, but this is what i get timestamps from camera:
1.3034
1.4544
1.6666
1.8604
2.0668
2.2683
2.4637
2.6559
2.8639
3.0599
3.2742
3.4597
3.6736
3.8622
4.0660
4.2715
4.4678
4.6561
4.8739
5.0589
5.2792
5.4598
5.6683
5.8559
6.0664
6.2578
6.4629
6.6613
6.8679
7.0656
and the time interval is :
0.1510
0.2122
0.1938
0.2064
0.2015
0.1955
0.1922
0.2081
0.1959
0.2144
0.1855
0.2138
0.1887
0.2037
0.2055
0.1964
0.1882
0.2179
0.1850
0.2203
0.1806
0.2085
0.1877
0.2105
0.1913
0.2052
0.1983
0.2066
0.1977
Can anyone explain why is the time interval irregular. Although it is approximately close to 0.200, but still why is it not exact 0.200? Am i missing any change in the default settings? I need to keep the fps = 5 exactly.
Please comment and help! Thanks
1 Comment
Iain
on 6 Jun 2013
This is not really a matlab problem.
You CAN operate the camera faster, and discard some frames.
Answers (1)
Walter Roberson
on 6 Jun 2013
If you could get 5 frames per second "exactly" then you would be able to define the SI unit of time in terms of your frame rate, which would save rather a lot of bother with super-cooled cesium ion traps or femtosecond ultraviolet lasers.
0 Comments
See Also
Categories
Find more on C4ISR in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!