Page 39 -
P. 39
Chapter 1 ■ Practical Aspects of a Vision System 13
{
fprintf(stderr, “Failed to save frame as '%s’\n“, filename);
} else
fprintf (stderr, “Saved frame as 'VideoFrame%d.jpg’\n“, n-1);
}
}
Free the camera to avoid possible problems later.
cvReleaseCapture( &camera );
// Wait for terminating keypress.
cvWaitKey(0);
return 0;
}
The data from the camera will be displayed at a rate of 10 frames/second,
because the delay between frames (as specified by cvWaitKey is 100 milli-
seconds, or 100/1000 = 0.1 seconds. This means that the frame rate can be
altered by changing this parameter, without exceeding the camera’s natural
maximum. Increasing this parameter decreases the frame rate. An example of
how this program appears on the screen while running is given as Figure 1.3.
Figure 1.3: How the camera capture program looks on the screen. The image seems
static, but it is really live video.