Featurelet Filters

After using a vision tool to find all of the featurelets in an image you may find you have many featurelets that are not pertinent to your application. To improve your application efficiency you may wish to eliminate featurelets you do not wish to process. You can do this with a featurelet filter.

Cognex provides a family of filter classes you can use to filter vectors of featurelets and vectors of featurelets. These classes are described below:

ccFeatureletFilter
This is the abstract base class for featurelet filters and featurelet chain filters. All of the Cognex filters described below derive from this base class. If you decide to write your own featurelet filter you must also derive from ccFeatureletFilter. Information on how to create your own filter class is covered in the ccFeatureletFilter reference page.

The ccFeatureletFilter base class contains the function filterFeaturelets() that you call to filter vectors of featurelets, and the function filterChains() you call to filter vectors of featurelet chain sets. The base class also contains the isInverted() function you can call to invert the filter. If you derive your own filter you must override the protected function filter_().

Note that all Cognex filters support featurelet chain filtering however, some filters do not support featurelet filtering. Cognex filters are described in the following paragraphs.

ccFeatureletFilterComposite
To use this filter you provide a vector of filters that are then run in sequence where each filter result is the input to the next filter. For example, if you call filterFeaturelets(), the function is run on all the filters in the filter vector, in vector order. The filtering performed is equivalent to, but more efficient than, calling filterFeaturelets() of each of the filters individually. Using ccFeatureletFilterComposite and the isInverted() base class function you can form filters capable of complex filtering operations such as logical and, and exclusive or operations.

ccFeatureletFilterBoundary
This filter provides functionality for filtering featurelets based on their positions, orientations, and polarities compared to a given ccShape boundary. You specify a distance tolerance, an angular tolerance, and whether to consider polarity.

Using this filter class you can call filterFeaturelets() to filter featurelets, or filterChains() to filter featurelet chain sets. In both cases each featurelet is analyzed as follows:

  • Each featurelet is compared with sampled points on the model boundary that are within the distance tolerance. If there are no such points, the featurelet survives and is not filtered out.
  • For points within the distance tolerance, the angular differences between the tangents of these points and the featurelet tangent angle are measured. If any of these angular differences is less than, or equal to the angular tolerance, the featurelet is filtered out. Otherwise, the featurelet survives. If you choose to consider polarity, it may have an impact on the measured angular difference. See the ccFeatureletFilterBoundary reference page for more details.

ccFeatureletFilterMagnitudeHysteresis
This filter class provides functionality for filtering featurelet chains based on hysteresis magnitude of the featurelets and their chains. You call filterChains() to filter featurelet chain sets. Calling filterFeaturelets() to filter featurelets is not supported by this filter.

This class allows you to filter featurelets based on a featurelet magnitude range. The magnitude is a featurelet property that represents its size.

ccFeatureletFilterLength
This filter class provides functionality for filtering featurelet chains based on their length, regardless of their open or closed status. You call filterChains() to filter featurelet chain sets. Calling filterFeaturelets() to filter featurelets is not supported by this filter.

ccFeatureletFilterRegion
This class filters featurelets based on whether they are inside or outside of a geometric region that you specify. The class can filter both featurelets and featurelet chain sets.

Each filter retains its run-time behavior as described in the preceding sections.

The Cognex filter classes are summarized in the table below.

 

Featurelets

Featurelet chains

Filter criteria

ccFeatureletFilterBoundary

Yes

Yes

distance, angle, polarity

ccFeatureletFilterMagnitudeHysteresis

No

Yes

featurelet magnitude

ccFeatureletFilterLength

No

Yes

chain length

ccFeatureletFilterRegion

Yes

Yes

featurelet location

ccFeatureletFilterComposite

Any sequence of the above filters. See ccFeatureletFilterComposite ccFeatureletFilterComposite To use this filter you provide a vector of filters that are then run in sequence where each filter result is the input to the next filter. For example, if you call filterFeaturelets(), the function is run on all the filters in the filter vector, in vector order. The filtering performed is equivalent to, but more efficient than, calling filterFeaturelets() of each of the filters individually. Using ccFeatureletFilterComposite and the isInverted() base class function you can form filters capable of complex filtering operations such as logical and, and exclusive or operations.

Filter class summary