IMcPatternMatchingFindPattern Method
|
|
Finds coordinates of best match of pattern.
Namespace:
MediaCy.IQL.Align
Assembly:
MediaCy.IQL.Align (in MediaCy.IQL.Align.dll) Version: 10.0.6912.0
SyntaxFunction FindPattern (
vImage2 As Object,
Optional NumExpectedObjects As Integer = 1,
Optional Threshold As Double = 0,
<OptionalAttribute> vImage1 As Object,
<OptionalAttribute> <OutAttribute> ByRef vOutRanks As Object
) As Object
Parameters
- vImage2
- Type: SystemObject
- NumExpectedObjects (Optional)
- Type: SystemInt32
number of expected objects to find. - Threshold (Optional)
- Type: SystemDouble
search threshold in range from 0 to 1. Default is 0, which will find all candidates. - vImage1 (Optional)
- Type: SystemObject
- vOutRanks (Optional)
- Type: SystemObject
Return Value
Type:
ObjectvOutValues - two dimensional array of arrays of AFFINE_TRANSFORM records corresponded to positions of
found objects on given frame. The first dimension of the array is [NumberOfFrames of Target image]
the number of elements in each element if equal or less than [NumExpectedObjects].
The array of AFFINE_TRANSFORM records is sorted by rank, so the objects in the beginning
of the array have higher correlation coefficients (matching degree).
vOutRanks - optional parameter. If provided, correlation ranks for every objects are returned in 2D array of doubles.
The array dimensions are the same as for vOutValues.
RemarksThe search pattern is defined by vRefImage. the parameters set in CorrelationMethodFFT used in the method.
If the number of expected objects is more than one, only translation is analyzed searching the pattarn.
In only one best match is requered Rotation and Scaling can also be activated in CorrelationMethodFFT.
Examples
Dim Im1 As McImage, Ref As McImage
Set Im1 = ActiveImage
ThisApplication.ActiveImage.Aoi.Reset
ThisApplication.ActiveImage.Aoi.SetBox 0, 62, 48, 83, 70
Set Ref = ThisApplication.ActiveImage.Duplicate
Im1.Aoi.Reset
Im1.PatternMatching.CorrelationMethodFFT.DoRotation = False
Im1.PatternMatching.CorrelationMethodFFT.DoScaling = False
Im1.PatternMatching.CorrelationMethodFFT.CorrelationMethod = mcCorrelationFFTPhase
Dim vOut, vRanks
vOut = Im1.PatternMatching.FindPattern(Ref, 50, 0.5, , vRanks)
Debug.Print "Transforms:" & GlobalTools.McToText(vOut).Value
Debug.Print "Ranks: " & GlobalTools.McToText(vRanks).Value
See Also