The following steps provide a basic methodology for a typical camera calibration:
Physically place the camera so that the working area is in its field of view.
Allocate a calibration context, using McalAlloc(). The calibration context will store the non-linear mapping between the pixel coordinate system and the world coordinate system, as well as information about the calibration setup, and the positions of all the coordinate systems.
Calibrate your camera setup, using either McalGrid() or McalList() with M_FULL_CALIBRATION to map image pixels to world points in the calibration context.
Associate the calibration context to an image or digitizer, using McalAssociate(), to enable working in real-world units.
Physically correct an image using McalTransformImage().
Save your calibration context using McalSave() or McalStream().
Free the calibration context using McalFree().
You can skip all of the above steps if no non-linear distortion is present and a uniform calibration is sufficient. Simply call McalUniform() to associate the default uniform calibration context with an image. Additional steps are required in M_3D_ROBOTICS mode. For more information, see the Uniform calibration and other calibration modes section later in this chapter.
If you move either the camera or relative coordinate system (that is, taking measurements in a different plane), you can remain calibrated in the following two cases:
If the movement is known, specify the transformation, using McalSetCoordinateSystem() with the camera coordinate system or the relative coordinate system as the target coordinate system.
If the movement is not known and using 3D-based calibration context, you can have the new position calculated automatically using McalGrid() or McalList() with M_DISPLACE_CAMERA_COORD or M_DISPLACE_RELATIVE_COORD, depending on what you have moved.