A collection indicating how the specified measures will
be used during execution of blob analysis. Blob measures can either
be used as filter criteria or precomputed such that the time
required to calculate the measure is part of the blob execution time.
Namespace: Cognex.VisionPro.BlobAssembly: Cognex.VisionPro.Blob (in Cognex.VisionPro.Blob.dll) Version: 65.1.0.0
Syntax
Property Value
Type: CogBlobMeasureCollectionThe default is an empty collection.
Events
| Event Type | Reason |
|---|---|
| ICogChangedEvent Changed | Fires when the value of this property changes. The following state flag may be affected: |
Remarks
A collection of CogBlobMeasure objects indicating how the specified measures will be used during execution of blob analysis. Blob measures can either be used as filter criteria or precomputed such that the time required to calculate the measure is part of the blob execution time.
You must sink change events from the collection to be notified when the measures change. This function only generates an event when the reference to the collection changes.
Examples
Imports Cognex.VisionPro
Imports Cognex.VisionPro.Blob
Dim myBlob As New CogBlob
Dim myAreaMeasure As New CogBlobMeasure
Dim myPerimeterMeasure As New CogBlobMeasure
Dim myBlobResults As CogBlobResults
Try
' Find all blobs with an area greater than 10 and' a perimeter greater than 100 pixels
myAreaMeasure.Measure = CogBlobMeasureConstants.Area
myAreaMeasure.FilterMode = CogBlobFilterModeConstants.IncludeBlobsInRange
myAreaMeasure.FilterRangeLow = 10
myAreaMeasure.FilterRangeHigh = 500000
myAreaMeasure.Mode = CogBlobMeasureModeConstants.Filter
myPerimeterMeasure.Measure = CogBlobMeasureConstants.Perimeter
myPerimeterMeasure.FilterMode = CogBlobFilterModeConstants.IncludeBlobsInRange
myPerimeterMeasure.FilterRangeLow = 100
myPerimeterMeasure.FilterRangeHigh = 500000
myPerimeterMeasure.Mode = CogBlobMeasureModeConstants.Filter
myBlob.RunTimeMeasures.Add(myAreaMeasure)
myBlob.RunTimeMeasures.Add(myPerimeterMeasure)
myBlob.ConnectivityCleanup = CogBlobConnectivityCleanupConstants.Fill
myBlob.SegmentationParams.Mode = CogBlobSegmentationModeConstants.HardDynamicThreshold
myBlob.MorphologyOperations.Add(CogBlobMorphologyConstants.CloseSquare)
' mobjImage is an acquired image
myBlobResults = myBlob.Execute(mobjImage, r)
Debug.WriteLine(myBlobResults.GetBlobs.Count.ToString)
Dim aResult As CogBlobResult
Dim avgArea As Double
For Each aResult In myBlobResults.GetBlobs
avgArea = avgArea + aResult.Area
Next
avgArea = avgArea / myBlobResults.GetBlobs.Count
Debug.WriteLine(" AvgArea:" + avgArea.ToString)
Catch ex As Exception
Debug.WriteLine("Following Error Occurred:" + ex.Message)
End Tryusing Cognex.VisionPro; using Cognex.VisionPro.Blob; private void doBlob() { CogBlob myBlob=new CogBlob(); CogBlobMeasure myAreaMeasure=new CogBlobMeasure(); CogBlobMeasure myPerimeterMeasure=new CogBlobMeasure(); CogBlobResults myBlobResults; Double avgArea=0; try { // Find all blobs with an area greater than 10 and' a perimeter greater than 100 pixels myAreaMeasure.Measure = CogBlobMeasureConstants.Area; myAreaMeasure.FilterMode = CogBlobFilterModeConstants.IncludeBlobsInRange; myAreaMeasure.FilterRangeLow = 10; myAreaMeasure.FilterRangeHigh = 500000; myAreaMeasure.Mode = CogBlobMeasureModeConstants.Filter; myPerimeterMeasure.Measure = CogBlobMeasureConstants.Perimeter; myPerimeterMeasure.FilterMode = CogBlobFilterModeConstants.IncludeBlobsInRange; myPerimeterMeasure.FilterRangeLow = 100; myPerimeterMeasure.FilterRangeHigh = 500000; myPerimeterMeasure.Mode = CogBlobMeasureModeConstants.Filter; myBlob.RunTimeMeasures.Add(myAreaMeasure); myBlob.RunTimeMeasures.Add(myPerimeterMeasure); myBlob.ConnectivityCleanup = CogBlobConnectivityCleanupConstants.Fill; myBlob.SegmentationParams.Mode = CogBlobSegmentationModeConstants.HardDynamicThreshold; myBlob.MorphologyOperations.Add(CogBlobMorphologyConstants.CloseSquare); // mobjImage is an acquired image myBlobResults = myBlob.Execute(mobjImage, r); Debug.WriteLine(myBlobResults.GetBlobs(true).Count.ToString()); foreach (CogBlobResult aResult in myBlobResults.GetBlobs(true)) { avgArea = avgArea + aResult.Area; } avgArea =avgArea / myBlobResults.GetBlobs(true).Count; Debug.WriteLine(" AvgArea:" + avgArea.ToString()); } catch (System.Exception ex) { Debug.WriteLine("Following Error Occurred:" + ex.Message); } }
See Also