Click or drag to resize

IMcProfileEdgesAdjustPropertiesByExample Method

Profile weighting and thresholding properties are analyzed and adjusted to automatically detect the current set of edges.

Namespace:  MediaCy.IQL.Features
Assembly:  MediaCy.IQL.Features (in MediaCy.IQL.Features.dll) Version: 10.0.6912.0
Syntax
VB
Function AdjustPropertiesByExample ( 
	Optional AdjustFlags As mcAdjustPropertiesByExampleFlags = mcAdjustPropertiesByExampleFlags.mcapbefNoAdjustFlags
) As Object

Parameters

AdjustFlags (Optional)
Type: MediaCy.IQL.FeaturesmcAdjustPropertiesByExampleFlags
Flags can be set to exclude adjustment of selected properties. In addtion, the mcapbefMakeRoughGuess flag removes the assumption that all good edges have been placed on the test profile. The mcapbefAnalyzeOnly flag will prevent any properties from being changed, but still proceeds with the analysis and returns the analyzed results; this flag is normally combined with the mcapbefKeepPattern flag.

Return Value

Type: Object
An array of type Double giving results of the edge analysis. The array elements are: count of properties changed by the routine, mean value of Pattern, StdDev of Pattern, count of edges on the test profile, mean edge correlation with the Pattern, StdDev of edge correlation with the Pattern, min edge correlation, max edge correlation, mean value at edges, min value at edges, max value at edges, mean StdDev at edges, min StdDev at edges, max StdDev at edges, count of non-edges, mean non-edge correlation with the Pattern, StdDev of non-edge correlation with the Pattern, min non-edge correlation, max non-edge correlation, mean value at non-edges, min value at non-edges, max value at non-edges, mean StdDev at non-edges, min StdDev at non-edges, max StdDev at non-edges.
Remarks
Edge finding is controlled by a number of properties that can interact in non-obvious ways. In many cases, this does not matter because edges are found only at obvious and unique points on clean profiles (e.g., at points of sharply rising luminance). In other cases, however things can be tricker (e.g., on noisy images) and his can make setting the edge weighting and detection properties a challenge. The AdjustPropertiesByExample will automatically set these parameters based on the edges currently on a profile. AdjustPropertiesByExample always works with the current set of edges on the ProfilesAncestor's first (zero'th) profile. There must be at least one edge on this profile and it must be placed at a location that shows some luminance variation in the profile. The MatchLength property must be set by the caller and is central to the analysis, since it determines the length of the Pattern matched and thus how closely edges may be detected. The analysis proceeds by first changing the EdgeFindingMethod to mcpefmMatchPattern, if necessary (this method is the most general). Next, the sections of the test profile about the test edges are averaged to come up with the Pattern property (this step is skipped if the mcapbefKeepPattern bit of the AdjustFlags argument is set). The test edge profile sections are analyzed to see how closely they match the pattern. Next, all sections of the test profile that correlate with the Pattern are detected, and spots that do not correspond with the test edges are marked as "non-edges". The "non-edge" profile sections are analyzed to see how closely they match the pattern. Finally, all of this information is analyzed to try to set the SizeWeighting, ThresholdForEdge and WeightingFlags properties, so as to maximize the chance of finding edges and not finding non-edges. The AdjustFlags argument allows you to specify that some or all of these properties are to be kept in their current state and not adjusted. After calling AdjustPropertiesByExample there is no guarantee that FindEdges will find exactly the set of test edges marked on the test profile. For well placed test edges, FindEdges will detect the same set of edges but will usually move them a little. Or it may miss some test edges or find some "non-edges". This is because FindEdges can only mark edges at spots on the profile that correlate well with the Pattern. All bets are off if the test edges mark random or conflicting profile patterns (e.g., some mark rising edges while others mark falling edges). To find edges that mark different profile patterns, you should create an McProfileEdges instance for each type of edge you were interested in (e.g., one for rising edges and one for falling edges). The Threshold will be set as a relative or absolute threshold depending on the state of the mcpeofAbsoluteThresholding of the OptionFlags property.
Examples
VB
Private Sub RoughGuess_PB_Click()
luCallAdjustPropertiesByExample mcapbefMakeRoughGuess Or luGetAdjustPropertiesByExampleFlagsFromControls
End Sub 'RoughGuess_PB_Click
Private Sub FullAutoAdjust_PB_Click()
luCallAdjustPropertiesByExample luGetAdjustPropertiesByExampleFlagsFromControls
End Sub 'FullAutoAdjust_PB_Click
Private Sub AnalyzeOnly_PB_Click()
luCallAdjustPropertiesByExample mcapbefAnalyzeOnly Or mcapbefKeepPattern Or _
mcapbefKeepSizeWeighting Or mcapbefKeepThresholdForEdge Or _
mcapbefPreserveBadEdges
End Sub 'AnalyzeOnly_PB_Click
Function luGetAdjustPropertiesByExampleFlagsFromControls() As mcAdjustPropertiesByExampleFlags
Dim flags As mcAdjustPropertiesByExampleFlags
flags = mcapbefNoAdjustFlags
If ResetHotspot_CB.value <> 0 Then flags = flags Or mcapbefResetHotspot
If KeepPattern_CB.value <> 0 Then flags = flags Or mcapbefKeepPattern
If SetPointsForSameSize_CB.value <> 0 Then flags = flags Or mcapbefSetPointsForSameSize
If SetPointsForSameOffset_CB.value <> 0 Then flags = flags Or mcapbefSetPointsForSameOffset
If KeepSizeWeighting_CB.value <> 0 Then flags = flags Or mcapbefKeepSizeWeighting
If KeepThresholdForEdge_CB.value <> 0 Then flags = flags Or mcapbefKeepThresholdForEdge
If PreserveBadEdges_CB.value <> 0 Then flags = flags Or mcapbefPreserveBadEdges
luGetAdjustPropertiesByExampleFlagsFromControls = flags
End Function 'luGetAdjustPropertiesByExampleFlagsFromControls
Sub luCallAdjustPropertiesByExample(flags As mcAdjustPropertiesByExampleFlags)
If s_mclineprofilesTest Is Nothing Then Exit Sub
Dim vAR As Variant
vAR = s_mclineprofilesTest.ProfileEdges.AdjustPropertiesByExample(flags)
'Now update the form to show the new properties
luSetFormControlsFromProperties s_mclineprofilesTest
Results_Label.Caption = McSprintf(McCStr("Adjust Results. ChangedPropertiesCount: %.0f \n" & _
"FalsePositivesCount: %.0f, FalseNegativesCount: %.0f, PatternMean: %.1f, PatternStdDev: %.2f \n" & _
"Edge Count: %.0f, CorrAvg: %.2f, CorrStdDev: %.2f, CorrMin: %.2f, CorrMax: %2f\n" & _
"MeanAvg: %.2f, MeanStdDev: %.2f, MeanMin: %.2f, MeanMax: %2f\n" & _
"StdDevAvg: %.2f, StdDevStdDev: %.2f, StdDevMin: %.2f, StdDevMax: %2f\n" & _
"Non-Edge Count: %.0f, CorrAvg: %.2f, CorrStdDev: %.2f, CorrMin: %.2f, CorrMax: %2f\n" & _
"MeanAvg: %.2f, MeanStdDev: %.2f, MeanMin: %.2f, MeanMax: %2f\n" & _
"StdDevAvg: %.2f, StdDevStdDev: %.2f, StdDevMin: %.2f, StdDevMax: %2f"), _
vAR(mcapberiChangedPropertiesCount), vAR(mcapberiFalsePositivesCount), _
vAR(mcapberiFalseNegativesCount), vAR(mcapberiPatternMean), _
vAR(mcapberiPatternStdDev), vAR(mcapberiEdgeCount), vAR(mcapberiEdgeCorrAvg), _
vAR(mcapberiEdgeCorrStdDev), vAR(mcapberiEdgeCorrMin), vAR(mcapberiEdgeCorrMax), _
vAR(mcapberiEdgeMeanAvg), vAR(mcapberiEdgeMeanStdDev), vAR(mcapberiEdgeMeanMin), _
vAR(mcapberiEdgeMeanMax), vAR(mcapberiEdgeStdDevAvg), _
vAR(mcapberiEdgeStdDevStdDev), vAR(mcapberiEdgeStdDevMin), _
vAR(mcapberiEdgeStdDevMax), vAR(mcapberiNonEdgeCount), vAR(mcapberiNonEdgeCorrAvg), _
vAR(mcapberiNonEdgeCorrStdDev), vAR(mcapberiNonEdgeCorrMin), _
vAR(mcapberiNonEdgeCorrMax), vAR(mcapberiNonEdgeMeanAvg), _
vAR(mcapberiNonEdgeMeanStdDev), vAR(mcapberiNonEdgeMeanMin), _
vAR(mcapberiNonEdgeMeanMax), vAR(mcapberiNonEdgeStdDevAvg), _
vAR(mcapberiNonEdgeStdDevStdDev), vAR(mcapberiNonEdgeStdDevMin), _
vAR(mcapberiNonEdgeStdDevMax))
End Sub 'luCallAdjustPropertiesByExample
See Also