There are two ways to calibrate cameras. The example uses the pattern matching method and I think you are just asking how to open the camera and get an image. You will also have to print the patterns on a piece of paper for the camera to see.
The one example located in opencv\sources\samples\cpp\tutorial_code\calib3d\camera_calibration
has a camera input mode. If you look at line 112 where if (inputType == CAMERA) inputCapture.open(cameraID);
You will see where it opens the camera using HighGui
The biggest issue I had with the example is that it ONLY adjusts for spherical distortion. You have to do several more steps to measure the rotation and shear and scale if needed.