The Identify method can be used to detect presence of similar templates once they have been added to the form set as well. The technique will be a combination of the two described in Detect Similar Templates before Adding to the Form Set:
As in the use of GetSimilarFormModels, the Identify method can only find similar templates to one selected template at a time. The method must be applied for each template in the form set to generate a complete list of similar form models.
For a selected form model, the Identify method (process described above) can be used almost the same way. The exception being that the IdentificationSubset's collection must be used because the selected form model is already in the form set.
The code below demonstrates how to configure the identification processor to detect similar templates to a specified one already in the collection.
C# Example |
Copy Code |
---|---|
// get index of current form model int currentFormModelIndex = GetCurrentFormModelIndex(); // load the image of the current form model System.Drawing.Bitmap candidateTemplateBitmap; candidateTemplateBitmap = LoadFormModelImage(currentFormModelIndex); // enable limiting identification to subset myIDProc.LimitIdentificationToSubset = true; // clear the identification subset myIDProc.IdentificationSubset.Clear(); // add all form model indices to the identification // subset, except for the current form model index for (int index = 0; index < myIDProc.FormModels.Count; index++) { if (index != currentFormModelIndex) myIDProc.IdentificationSubset.Add(index); } |