Before you grade the quality of a printed or marked (etched, stamped, or otherwise applied on the part) code, you should configure (calibrate) your setup so that you are analyzing the printed/marked code and not how well the code can be read in the current environment. This involves adjusting the environment and establishing the grading settings that the CodeGrade step should use to grade your target codes in this environment. The settings depend on the grading standard used; if rigorous calibration is not possible, you can approximate the grading setting.
Ideally, the setup and configuration for grading should be done following the calibration procedures described in the remainder of this section, using a standard test card. If it is not possible to implement the calibration procedure (for example, due to lack of reference cards or physical and workflow constraints), you can use approximate values that should give you good results, but will not be as accurate as following a full calibration.
Adjust the image setup to:
Maximize the contrast and minimize noise in the image.
Avoid pixel saturation.
Have a cell size of at least 3. A smaller cell size results in a less robust result.
Have a uniform foreground and background grayscale level (that is, there should be no glare or dark spots present in the image).
Set the Min. Calibrated Reflectance (Rmin) and Max. Calibrated Reflectance (Rmax) inputs to the expected minimum and maximum possible grayscale value in the target image. For example, if the minimum and maximum possible values are 10 and 230, respectively, given your lighting conditions, specify these values.
When grading printed codes, you should use the ISO standard (corresponds to ISO/IEC 15415 for 2D code types and ISO/IEC 15416 for 1D code types). When you calibrate for the ISO standard, you adjust the environment and establish exact values for the following grading settings:
Input |
Description |
Min. Calibrated Reflectance (Rmin) |
Specifies the expected minimum possible grayscale value in the target image. |
Max. Calibrated Reflectance (Rmax) |
Specifies the expected maximum possible grayscale value in the target image. |
The general ISO standards provide only general guidelines for configuring your setup for code grading. The following procedure is designed to assist in modifying your setup until ideal conditions are obtained. A grabbed image of a near-perfect code is used since you know the grade of a perfect code should be A, as long as the setup is not influencing the grade. Typically, the following procedure is done from an event-triggered subflowchart.
In the environment in which you will eventually be grading your codes, put a perfectly printed sample code (for example, a standard test card for your code type, such as the GS1 Data Matrix calibrated conformance standard test card or the NIST-traceable EAN/UPC calibrated conformance standard test card) in the field of view.
Grab an image of the sample code.
Perform a CodeReader step, and if the code is found, perform a corresponding CodeGrade step.
If the OverallSymbolGrade output of the CodeGrade step is not an A, then as necessary, adjust the image setup to:
Maximize the contrast and minimize noise in the image.
Avoid pixel saturation.
Have a cell size of at least 3. A smaller cell size results in a less robust result.
Have a uniform foreground and background grayscale level (that is, there should be no glare or dark spots present in the image).
Repeat steps 2 to 4 until the resulting grade is an "A" (or the best possible grade given the surface on which the code is printed).
For a 2D code type, reconfigure the Min. Calibrated Reflectance and Max. Calibrated Reflectance inputs of the CodeGrade step in the main flowchart, to the Rmin and Rmax outputs of the CodeGrade step used during calibration, respectively.
For a 1D code type:
Get the recommended aperture size according to the ISO/IEC 15416:2000 or ISO/IEC 15415:2011 standard.
Add an ImageProcessing step after the CodeGrade step. Configure the ImageProcessing step to perform multiple Smooth operations; this operation is listed under the Filtering operation category. The step should perform at least 1 Smooth operation, and at most a number of times equal to the following: (Recommended Aperture size + 0.5)/2.
Add an IntensityChecker step.
Reconfigure the Min. Calibrated Reflectance and Max. Calibrated Reflectance inputs of the CodeGrade step in the main flowchart, to the Minimum and Maximum outputs of the IntensityChecker step, respectively.
Note that for better accuracy, after adjusting your setup using an A-grade code, you can also grab and test images of non-perfect codes with known grades, if present on your standard test card. For these codes, instead of retrieving the overall grade in step 4, retrieve the …Grade output obtained for the code attribute that is not perfect, to see if the returned grade matches the known grade.
When grading Aztec, Data Matrix, QR code, or Micro QR code types that are direct part marked (DPM), you should use the AIMDPM (ISO/IEC TR 29158:2011) grading standard. When you calibrate for the AIMDPM standard, you adjust the environment and establish exact values for the following grading settings:
Input |
Description |
|
Reflectance Calibration |
Specifies the expected reflectance value. This corresponds to the maximum possible intensity of the centers of the white elements of the code occurrence. |
|
Mean Light Calibration |
Specifies the expected mean light value. This corresponds to the expected mean intensity of the centers of the white elements of the code occurrence. |
Their default values are established from the Min. Calibrated Reflectance (Rmin) and Max. Calibrated Reflectance (Rmax) inputs, which correspond to the expected minimum and maximum possible grayscale value in the target image (for example, 10 and 240, respectively).
Ideally, all factors affecting the intensity of grabbed images (that is, lights, exposure and gain settings, and surface characteristics) during calibration and production are identical. This is strongly advised. Otherwise, you can set the advanced inputs: SystemResponseCalibration and SystemResponseTarget; their ratio tells the code grade algorithm how much brighter or darker a perfect marked code would appear within the target setup, when compared to the calibration setup. If the difference in the settings can be expressed as a constant that is proportional to the change in intensity (for example, exposure), then providing the calibration and target values of the constant might provide more accurate grades.
Calibrating for the AIMDPM grading standard is technically implemented in 2 phases: the reflectance calibration phase and the target grading phase. These establish the settings of the environmental factors that result in an acceptable image of a perfect reference code (printed) and a target code (direct part marked), respectively. The second phase is only necessary if you need to set the SystemResponseCalibration and SystemResponseTarget inputs; otherwise, these inputs can be left to their default value of 1. Typically, the following procedure is done from an event-triggered subflowchart.
In the reflectance calibration phase:
Place an A-grade code, printed on a standard test card, in the field of view (for example, the GS1 Data Matrix calibrated conformance standard test card or the NIST-traceable EAN/UPC calibrated conformance standard test card); the code is used as the reference code. The reference code can be of any code type (even a 1D code type).
Adjust the lighting according to the AIMDPM (ISO/IEC TR 29158:2011) grading standard.
Grab an image of the reference code.
Perform a CodeReader step configured for the reference code; if the reference code is found, perform a corresponding CodeGrade step. For this phase, set the Grading standard input of the CodeGrade step to ISO.
From the results of the CodeGrade step, calculate the mean light ratio: ((MeanLightCalibration output) / Max. Calibrated Reflectance (Rmax) input).
If the mean light ratio is not within 70% and 86%, adjust your environmental factors (the location, camera, and/or lighting setup) and repeat steps c to f until the mean light ratio is within this range.
Reconfigure the Reflectance Calibration and Mean Light Calibration inputs of the CodeGrade step in main flowchart, to the Reflectance Calibration and Mean Light Calibration outputs of the CodeGrade step used in reflectance calibration phase. The CodeGrade step in main flowchart should have its Grading standard input set to AIMDPM, and be linked to a CodeReader step configured for the target code.
If implementing the target grading phase:
Calculate the System Response value for the reflectance calibration environment. To do so, use a user-defined aggregate of the environmental factors that you used to create the conditions for an acceptable reference code. For example, you could set the System Response value to be ( Exposure time * Gain factor).
Acquire an image of the target code (DPM) in the target environment.
All environmental factors must be the same as those used in the reflectance calibration phase, except those factors used to calculate the System Response values.
Perform a CodeReader step configured for the target code.
If the target code is found, perform a corresponding CodeGrade step. For this phase, configure the CodeGrade step such that:
Input to set |
Setting |
Grading standard |
AIMDPM |
Reflectance Calibration and Mean Light Calibration |
Reflectance Calibration and Mean Light Calibration outputs of the CodeGrade step used in the reflectance calibration phase, respectively. |
System Response Calibration |
The System Response value calculated for the reflectance calibration environment in step 2.a. |
System Response Target |
The System Response value for the current environment. Use the same formula as the one used for reflectance calibration phase. For example, if you have set the System Response Calibration input to (Exposure time * Gain factor), set the System Response Target input to (Exposure time * Gain factor) for the current environment. |
From the results of the CodeGrade step, calculate the mean light ratio: (MeanLightTarget output/ Max. Calibrated Reflectance (Rmax) input).
If the mean light ratio is not within 70% and 86%, adjust only those environmental factors used to calculate the System Response value, adjust the System Response Target input accordingly, and repeat steps b to f until the mean light ratio is within this range. During the target grading phase, you should not alter any environmental factors other than those used to calculate the System Response value.
Reconfigure the System Response Calibration and System Response Target inputs of the CodeGrade step in main flowchart, to the SystemResponseCalibration and SystemResponseTarget outputs of the CodeGrade step used in target grading phase.
For more information, especially regarding the guidelines for lighting environments and reflectance calibration configurations, refer to the ISO/IEC TR 29158:2011 specification.