OpenCV Seting and working with a camera
Working in opencv with cameras is very easy, we only need a camera and our opencv libraries.
The structure that we store the camera link is CvCapture, here we store this link, then to get this link we need call to cvCaptureFromCAM function, this function need only one param, the index of the camera to be used. If there is only one camera or it does not matter what camera to use -1 may be passed.
Then this is our basic line to retrive our camera link
CvCapture* capture = cvCaptureFromCAM( 0 );
Then we only need get each frame we can capture with cam, to do this we can use the cvQuetyFrame passing as param our camera link and it return a IplImage* struct that we can show.
IplImage* frame = cvQueryFrame( capture );
With this easy lines we can get all frames we need from our camera.