Click or drag to resize

IMcProfileEdgesPattern Property

Luminance patter to use for the mcpefmMatchPattern EdgeFindingMethod

Namespace:  MediaCy.IQL.Features
Assembly:  MediaCy.IQL.Features (in MediaCy.IQL.Features.dll) Version: 10.0.6912.0
Syntax
VB
Property Pattern As Object
	Get
	Set

Property Value

Type: Object
Remarks
For the mcpefmMatchPattern EdgeFindingMethod the weighted profile is determined from the covariance of the profile lumianance and the Pattern property array. By default the pattern property is a flattened, rising step, but you will almost always want to assign your own pattern (otherwise the one of the simpler weighted average EdgeFindingMethod approaches will probably work for you). When you assign to the Pattern property, the MatchLength property is automatically set to the length of the assigned array. If you subsequently change the MatchLength, then the Pattern property array is automatically mapped onto the new MatchLength. On assignment Weights array must be at least length 2 and the values must not be all the same; that is, the Pattern must have some shape to it. Before being used to produce the WeightedProfiles, the Pattern array is mapped (stretched or interpolated) to the MatchLength. The Pattern property is exposed as an array of Double. The Pattern property is ignored by the weighted average methods (EdgeFindingMethod values mcpefmPeaks, mcpefmValleys, mcpefmRisingEdges and mcpefmFallingEdges).
Examples
VB
'Set the Pattern from a supplied McLines
SetPatternFromUserMcLines( ByRef ProfileLine As McLines, ByRef UsersLine As McLines)
'If the supplied McLines has no line feature, then start the line tool
If UsersLine.Count = 0 Then
MsgBox "Draw a line across the desired patter."
'Make sure that auto-display of the UsersLine features is on
UsersLine.DisplayOverlays.AutoDisplayTemplateID = mcgtStandardAutoDisplay
'Turn on the simple line tool
UsersLine.DisplayOverlays.MasterGraphOverlay.SelectTool "", "McGraphObjLine", mcgtStandardAutoDisplay
Exit Sub 'and quit until there is a line
End If
UsersLine.Profiles.Interpretation = mciMonochrome 'intensity only
UsersLine.Profiles.SampleMode = mclpsmFixedSampleLength
UsersLine.Profiles.LengthPerSampleDesired = 1#  'one pixel per sample
'Now set the Pattern for our ProfileLine
ProfileLine.Profiles.ProfileEdges.Pattern = UsersLine.Profiles.ProfileValues(0)
End Sub
'Call the below twice.  The first time it will tell you to draw a line
'over the desired pattern.  The next time it will assign the pattern
'and find the "edges"
Sub DoOneSetPattern()
'Capture the pattern sample as the entry state of ThisApplication.ActiveImage.LineFeatures
Dim PatternSampleLine As McLines
Set PatternSampleLine = ThisApplication.ActiveImage.LineFeatures.Duplicate
ThisApplication.ActiveImage.LineFeatures.Reset 'Clear ThisApplication.ActiveImage.LineFeatures
SetPatternFromUserMcLines ThisApplication.ActiveImage.LineFeatures, PatternSampleLine
If PatternSampleLine.Count = 0 Then Exit Sub 'must wait for user to create pattern line
'Else we are done withe the pattern line.  Remove it.
Set PatternSampleLine = Nothing
'Create diagonal line
ThisApplication.ActiveImage.LineFeatures.SetFeaturePoints 0, Array(0&,0&,ActiveImage.Height-1,ActiveImage.Width-1)
With ThisApplication.ActiveImage.LineFeatures.Profiles
.Interpretation = mciMonochrome 'intensity only
.SampleMode = mclpsmFixedSampleLength
.LengthPerSampleDesired = 1#  'one pixel per sample
.ProfileEdges.EdgeFindingMethod = mcpefmMatchPattern
.ProfileEdges.FindEdges 'get them edges
'Show the edge tic marks
.ProfileEdges.EdgeTicMarksAsMcLines.DisplayOverlays.AutoDisplayTemplateID(True) = mcgtStandardAutoDisplay
End Sub 'DoOneSetPattern
See Also