# How to run two independent pose computers for two parts in one image

In some alignment applications there are two independent parts within the same field of views of cameras which require to be located separately. In the example below, there is a white protect film on the black screen, the relative pose between film and screen is not fixed. The vision system's task here is to find where the film is(marked in red) and then locate where the screen is(marked in blue), so that the machine can first remove the film, and then align the screen.

## Wizard Configuration

In these kind of applications, user usually does not want to acquire images twice for each part and run two independent features finder as that will increase processing time. Rather, user would like to acquire once, run one features finder to find all features together, and compute two poses using features from each part. To achieve that, here is how wizard should be configured.

In this configuration, there are two alignment components, both of which use all features found in Features0 for pose computing as AlignPlus cannot tell which feature belongs to which part. Therefore, the auto-generated alignment tasks will run through exactly the same process with the same inputs and outputs. However, this configuration provides a good structure for you to customize upon.

## Feature Finding

To start with, we need to find all features first as shown below:

There are four corner finders inside Features0, Finder00 and Finder 02 find the two corners of the screen; Finder01 and Finder03 locates the corners the film.

## Customization

The goal is to let alignment0 run pose computing for film, and alignemnt1 for screen. Instead of all alignment tasks using all features, we can filter the features inputs so that each task only receives features it absolutely needs.

Here is where filtering takes place:

The FeatureAndCommandSubscribers subtask in the alignment task is responsible for subscribing train time and run time features and their commands from corresponding feature finding task. Its second output pin is a list of run time features, last output pin is a list of train time features. As displayed below, it uses all features from the feature finder by default .

To filter out those unwanted train time and run time features, one can insert two script blocks between FeatureAndCommandSubscribers and OffsetCompensation.

For Alignment0, only features from film are needed (Finder01 and Finder03). Here are the steps of customization:

1. Add a script block named as "FilterFeatures", configure its input and output as below:

2. Add Cognex.Designer.AlignPlus.Alignment.dll to its references.

3. And "Cognex.Designer.AlignPlus.Alignment" to its name space.

4. Inside the script, input the following code:

5. Copy the block and rename it as "FilterTrainFeatures", link its input pin to trained features of FeatureAndCommandSubscribers subtask, and output pin to OffsetCompensation subtask.

After the customization, the alignment0 will only handle features from film as shown below:

For Alignment1, the customization is exactly the same except the feature names in its script blocks should be "Feature00" and "Feature01" representing the screen part.