I am looking for a way to regularly capture quickly changing frames using general webcam.
For example, my pesudo code is
int fps = 0, oldT = 0, curT = 0;
while (1)
{
fps++;
std::cout << fps << " ";
oldT = curT;
while (curT - oldT < 50) { curT = timeGetTime(); }
}
It means that webcam regularly captures the screen which shows increasing numbers. The desired results are the regularly captured images which contain the increasing numbers.
Some of the result images contained the same numbers and the result image sequence skipped some numbers such as
img1 -> 1
img2 -> 1 2
img3 -> 1 2 // unwanted result -> same number
img4 -> 1 2 // unwanted result -> same number
img5 -> 1 2 3 4 // unwanted result -> skip number
img6 -> 1 2 3 4 5
....
With poor background, I have tried to regularly capture frames. However, now, I doubt whether it is possible using webcam.
What I have tried:
I have used either
videocapture in openCV or
ISampleGrabber in directshow, however, I cannot obtain the desired results.
in my opinion, if these unwanted results are due to camera internal buffers for encoding, the unwanted result are regularly presented. But....I think that the unwanted results are irregular.
please, help me..