Courtesy of National Instruments. Figure 4 . Depending on the lens you choose and how you set it up, you can get more or less depth of field. You need a deeper depth of field to focus components that vary significantly in height. First things first The first calibration step involves relating actual lengths to the numbers of pixels between points in a captured image.
People measure distance in inches, millimeters, microns, and other units.
You can run a simple calibration by placing an accurate steel ruler with crisp, contrasting marks in the center of your vision system's field of view. The ruler should rest flat on the surface and perpendicular to your camera's center axis. Try to place the ruler parallel to the x or y axis of your camera's pixels. Watch the image display to see how you're doing as you position the ruler. Careful positioning will let you measure a distance along a row or column of pixels rather than diagonally across rows and columns.