Advance Camera Calibration Camera Mounting Errors - strChrisLee/openpnp GitHub Wiki

Camera Mounting Errors

Ideally, cameras are mounted such that their image axes are aligned parallel with the machine X-Y axes and their optical axes are parallel with the machine Z axis. That is, the cameras are expected to be mounted so that their images are perfectly "square" with the machine's X-Y axes and that they look perfectly straight up or down (no tilt). In practice however, it may be quite difficult to mount a camera that achieves that ideal. Even if the camera case/PCB is mounted exactly aligned with the machine's axes, there is no guarantee the camera's internal mounting of the image sensor and lens system are so aligned.

The consequences of uncorrected camera mounting errors are two-fold. First, and most obvious, is that if the image axes are not aligned with the machine's X-Y axes, there will be an error in the rotation of imaged objects. The second is that if the optical axis of the camera is not perfectly vertical, there will be an apparent shift in the measured X and/or Y coordinate of the object that varies with the object's Z as shown in the animated figure below.

CameraTiltGif

Advance Camera Calibration corrects for these mounting errors by remapping the image pixels so that the image appears to be from a camera ideally aligned and mounted at the physical camera's location. The remapping is done in such a way that the pixel corresponding to the camera's vertical ray appears at the intersection of the camera view's crosshairs. Thus insuring measurement of an object's position is independent of the object's Z. However, the remapping of pixels may produce results that are unexpected to the operator if they are unaware of them. The figure below shows how the corrected images from a top camera would appear due to various mounting errors (for bottom cameras the X and Y rotational errors will have the opposite sign). The blue outline shows the extent of where the pixels from the physical camera get mapped to the camera's view (note, this assumes all valid pixels from the camera are being displayed):

Camera Mounting Errors

One consequence of the remapping is that edges of the image may be off center relative to the crosshairs which means a reduction in the size of the largest object that can be centered on the crosshairs and yet still be fully observed in the image (see the X and Y mounting error images above). If this is a problem, the physical mounting errors need to be corrected and the camera recalibrated afterwards. To aid in this, Advanced Camera Calibration displays the mounting errors to the operator. To make the correction, rotate the camera using the right hand rule in the direction opposite the sign of the error. Since the angles tend to be difficult to measure, it is easy to overdo the correction so it is recommended to only attempt to correct about half of the error at any one time and reperform the calibration. Also keep in mind that correcting these errors is only necessary if the images are too far off center from the crosshairs. Otherwise the mounting errors contribute very little if any to the degradation of the machine's overall performance.