AngleCorrelation Angle

The Correlation Angle tool allow the user to train Automation Manager to find a specific piece of an image at any angle by comparing it to a predefined image (what we will call the model) that has been captured at multiple angles.

Using the Correlation Angle Tool

The Correlation Angle tool needs to be trained before it can be run.

Training the Model

Select the Correlation Angle tool in the sequence by clicking it.  A blue ROI will appear on the Viewer Window.  Arrange the blue ROI over the part of the image to train.  Right-click the tool and choose "Train".

Next, look on the tool's Models page.  Use the right and left arrows to view the model you have trained at different angles.  

The dropdown menu has three options:
Model is the actual image of the model you have trained.
Model-Low Resolution shows how the model looks in low resolution mode.
Result Image shows an image result of the correlation. Points of correlation are shown as light spots.

The Angle page sets the angles and incriments at which the model will be trained.  These settings are set in degrees.
Angle Start sets the initial angle.  
Angle Incriment sets how many degrees the ROI will rotate between grabs.  If the Angle Incriment is set to 10 then the tool will grab a new picture of the model every10 degrees.
Number of Angles sets the number of images that will be trained of the model.
If the Number of Angles is set to 5, and the Angle Incriment is set to 10, and the Angle Start is set to 30 then a picture of the model will be grabbed at 30, 40, 50, 60 and 70 degrees.

Running the Correlation

Once the tool is trained the green ROI needs to be positioned on the Viewer Window so that the target of correllation will always be in view as subsequent pictures are taken.  When the tool is run it will but a mark at the center of the greatest area of correllation and put record results in the tool's parameters page.

Score is the level of correlation.  1 is a perfect match.
Angle_Radians and Degrees reports the angle at which the model had the highest level of correllation to the grabbed image.  
Point is the point at the center of the greatest correllation.  This point can be passed to other tools.

More Settings

On the tool's parameters page check the UseAngleHint box to suggest an angle for the tool to consider first.  Set that angle in the AngleHint box.  When the AngleHint is set the tool will check the defined angle for correlation first.  This setting can be used to speed the tool if the angle of correlation is typically known.

On the tool's inputs page the TrainROI can be deleted.  In this case the green SearchROI can be used for training and searching.

The Correlation page sets how the tool runs.  The correlation tool works by doing a low resolution pass search for the model (i.e. what you have trained).  After this low pass search is done over the entire image there may be several canidates that could possibly be the right match.  Next, a high resolution scan is done on each of the possible canidates.  The caniditate with the highest percentage of similarity will be selected from the image.

The Minimum Accpet Score is a percentage based on similarity (of shape, not brightness or contrast) to the trained model.  If the score is below the Minimum Accept Score, nothing will be selected from that image and it fails the part.

Sub Sample X
Sub Sample Y
The correlation does a low resolution pass search of the entire image for the model. This low pass search is done to select possible regions that may correlate to the model you have trained.  Based on the possible regions found in the low resolution pass a high resolution pass is done to select the sector that is most similar to the trained model.  The low pass search speeds up the execution time to find the model.
The subsample factors define how to render the image for the low pass search. For example, if the subsample is 3 then only every thrid pixel is used in the low resolution pass. Note: the higher these factors the faster the search, but if the sub sample factors are too high, then the model may not be found. To check that the factors are not too high, view the "Model-Low" resolution model and hit "Re-Train". This low resolution model should be recognizable.




The Re-Train button will retrain the Low Pass model only.  It will resample the model with a lower resollution for the first pass (see above - Sub Sample).  When the "Sub Sample" X and/or Y have been adjusted the "Re-Train" button must be hit in order for the change to be made.  You can see how the change has affected the model be selecting "Model-Low Resolution" from the dropdown menu.  "Re-Train" will only resample the model that has already been trained, it will not genetrate a completely new model.