| Customize Help

Degrees of freedom

The Metrology module has been configured, by default, to conduct a fast and robust calculation of physically measured features in the target image. This is done, in part, by typically using all edgels in the feature's metrology region. However, for unusually complex target images, or to fit your application's needs, you might want to restrict which edgels are used. Eliminating unwanted edgels can result in a more precise feature extraction, a more accurate fit, and a more robust calculation. Edgels within the metrology region that don't pass certain constraints are eliminated; the remainder can be considered active edgels. The following animation shows how edgels are selected within a region of interest.

Before adjusting edgels, you should ensure that the quality of your image is good. To do so, you can customize the processing settings for the edge extraction algorithm. For example, you can remove image noise by performing a smoothing operation. To adjust the processing settings, use MmetControl(), and alter the:

These settings can be adjusted for each physically measured feature, or for the entire metrology context, which will affect all physically measured features. For more information on customizing the edge extraction algorithm, see the Customizing the edge extraction settings section of Chapter 9: Edge Finder.

Active edgels and fitted edgels

Active edgels are those edgels, in the metrology region, that satisfy the edgel constraints. Typically, they are used to build the feature. The edgel constraints include:

Fitted edgels are those active edgels, in the metrology region, used by the fit operation to define a fitted feature. They satisfy both the edgel constraints mentioned above, and the following fit constraints:

For fit operations, it is possible to have active edgels that are not used to construct a feature. This occurs when there are edgels that satisfy the edgel constraints (active edgels), but do not satisfy the fit constraints (fitted edgels). Therefore, the fitted edgels are the subset of active edgels used to construct the feature. For example, an inner fit and outer fit can produce two different features, and ultimately have two different sets of fitted edgels despite one common set of active edgels.

The fit constraints (M_FIT_...) can alter the precision of the edge that is ultimately fit; however, they might not reliably discard outliers (outlier pixels/points) when they significantly impact the initial fit (the first iteration of the fit). When dealing with a lot of outliers, use a robust best fit (M_ROBUST_FIT). For more information on fit operations, see the Best fit, inner fit, and outer fit operations subsection of the Features section earlier in this chapter.

Gradient angle

The gradient angle (edgel direction) is the counter-clockwise angle between the target image's horizontal axis and the edge's gradient (the direction of the edgel's most sudden change from black to white) at each edgel location. The following example illustrates various edgels and their direction.

You can filter out unwanted edgels by restricting the degrees of freedom applied to the edgel's gradient angle. To do so, use MmetControl() with M_EDGEL_ANGLE_RANGE. Only those edgels that have a gradient angle that falls within the angular range can be used to build the feature. You can set the angular range to any value between 0.0° and 360.0° (the default is 180.0°).

By default, the angular range is set relative to the metrology region's orientation. To change the relative angle, use MmetControl() with M_EDGEL_RELATIVE_ANGLE. If the relative angle is set to M_SAME (the default), only those edgels that have the same gradient angle (from black to white) as the metrology region's orientation, and whose gradient angle falls within the angular range, will be used. If the relative angle is set to M_REVERSE, only those edgels that have the opposite gradient angle (from white to black) of the metrology region's orientation, and whose gradient angle falls within the angular range, will be used (+180°). You can also set the relative angle to same or reverse (M_SAME_OR_REVERSE). Note that for circular metrology regions (arc, ring, ring-sector), the metrology region's orientation is radial. For more information on metrology regions, see the Metrology regions subsection of the Features section earlier in this chapter.

The following example shows how the gradient angle range (approximately 60°) and the relative angle (same and reverse) settings can be used with a rectangular metrology region and a ring-sector metrology region to select active edgels.

The following example shows how the relative angle settings can be used with an arc-shaped metrology region to select different active edgel features in an object. Note that to get these results, a slight angular range must also be applied.

Note that gradient angle restrictions apply when building either physically measured features, or constructed features that use physically measured edgels as a source.

Edgel selection rank

The edgel selection rank refers to the rank of the edgels to select when scanning the metrology region column by column from bottom to top. For example, if there are several possible edgels in a given column of the metrology region, the rank will determine whether the first edgel found, as opposed to the second or any subsequent edgel, is selected. To specify the rank, use MmetControl() with M_EDGEL_SELECTION_RANK. If the edgel selection rank is set to M_LAST, the last edgel found in the column will be used. Note that this control type takes effect after M_EDGEL_RELATIVE_ANGLE and M_EDGEL_ANGLE_RANGE are satisfied.

In the following example, there are multiple edges in the metrology region. The solid gray line illustrates the edgels selected when M_EDGEL_SELECTION_RANK is set to 1; the dotted gray line illustrates the edgels selected when M_EDGEL_SELECTION_RANK is set to 2.

Minimum and maximum fit settings

Metrology calculates the fit of a feature based on an iterative process, where each iteration results in a more accurate fit than its predecessor. This process results in a robust fit where unwanted edgels, such as noise, can be eliminated. To control the fit calculation, you can use the minimum and maximum fit settings M_FIT_COVERAGE_MIN, M_FIT_ITERATIONS_MAX, M_FIT_VARIATION_MAX, and M_FIT_DISTANCE_MAX.

The iteration process takes into account the minimum fit coverage (M_FIT_COVERAGE_MIN), which represents an estimation of how much the fitted feature must be covered by fitted edgels. The actual coverage that results from this setting depends on the scale of the image at which the feature edges were extracted, as specified with M_EXTRACTION_SCALE; a scale of 1 provides the best estimation. To set M_FIT_COVERAGE_MIN, you must specify a percentage based on the feature as a whole. For example, by specifying 80, you are indicating that approximately 80% of the entire fitted feature must be covered by fitted edgels, which also implies that the remaining parts of the feature can be gaps. As expected, the greater the minimum fit coverage, the more fitted edgels are needed to cover the feature. The default is 0%.

For constructed features using a fit operation performed on multiple physically measured edgel features, the accuracy of the minimum fit coverage is based on the average of each feature's extraction scale. For physically measured or constructed arcs, circles, and segments, you can retrieve the actual coverage of the feature using MmetGetResult() with M_COVERAGE.

The maximum fit iterations setting (M_FIT_ITERATIONS_MAX) allows you to set the maximum number of iterations used to compute a fitted feature. When this value is reached, the iteration process ends. A setting of one will consider all edgels (pixels/points) in the fit. Settings higher than one will progressively eliminate outlying edgels (outlier pixels/points) in the fit. The more iterations, the better the fit, but the longer the calculation. By default, the number of iterations is determined automatically.

The iteration process can also end if the maximum fit variation setting (M_FIT_VARIATION_MAX) is reached. The maximum fit variation setting represents the maximum allowable difference in the value of the feature's underlying coefficients, from one fit iteration to the next. For example, a segment feature has 4 coefficients: the X-coordinate of its start point, the Y-coordinate of its start point, the X-coordinate of its end point, and the Y-coordinate of its end point. During each iteration, the segment's fit becomes more accurate and therefore, the values of its coefficients change and stabilize. If, for instance, the maximum fit variation setting is set to 0.05, then as soon as the difference of each coefficients' value between iterations is less than 0.05, the iteration process ends.

During the iteration process, the maximum fit distance setting (M_FIT_DISTANCE_MAX) is applied. This setting limits the distance an active edgel can be from the current iterative fit for it to be considered in the next iterative fit. For example, if the first iterative fit of the iterative process includes all active edgels, one of which is farther away from the fit than the distance specified by M_FIT_DISTANCE_MAX, this edgel will not be taken into account during the next fit iteration. The higher the value of M_FIT_DISTANCE_MAX, the farther away an active edgel can be for it to be considered in the next iteration of the fit calculation. You must set this value in pixel units. The default is no maximum distance. If all the remaining edgels fall within the maximum allowable distance, they are considered as fitted edgels, provided they pass all other edgel constraints that have been set (for example, the gradient angle restrictions).

Note that the minimum and maximum fit settings apply when building either physically measured features or constructed features with a fit operation.

Copy feature edgels

When adding a constructed edgel feature with the copy feature edgels operation (M_COPY_FEATURE_EDGELS) in MmetAddFeature(), the new edgel feature can be built using the active edgels (default), the fitted edgels, or all the edgels in the base feature's metrology region, regardless of any edgel constraints. For example, if you select the active edgels and use M_COPY_FEATURE_EDGELS with a base feature that was built using the best-fit operation for a segment, edgels that were not considered active when calculating the segment's best fit are not included in the new feature.

To select the active edgels, fitted edgels, or all edgels, use MmetControl() with M_EDGEL_TYPE set to M_ACTIVE_EDGELS, M_FITTED_EDGELS, or M_ALL_EDGELS, respectively. Note that these settings only affect the copy feature edgels build operation (M_COPY_FEATURE_EDGELS). For other build operations, each edgel constraint control must be adjusted according to your active edgel requirements.