CogBlob SortMeasure Property Cognex VisionPro
The blob measure that will be used for sorting the filtered collection of blobs. SortMeasure is only used if SortEnabled is true.

Namespace: Cognex.VisionPro.Blob
Assembly: Cognex.VisionPro.Blob (in Cognex.VisionPro.Blob.dll) Version: 65.1.0.0
Syntax

public CogBlobMeasureConstants SortMeasure { get; set; }

Property Value

Type: CogBlobMeasureConstants
The default is Area
Events

Event TypeReason
ICogChangedEvent Changed

Fires when the value of this property changes.

The following state flag may be affected:

Exceptions

ExceptionCondition
ArgumentException The supplied value is not a member of CogBlobMeasureConstants
Remarks

The blob measure that will be used for sorting the filtered collection of blobs. SortMeasure is only used if SortEnabled is true.

Examples

 Imports Cognex.VisionPro
 Imports Cognex.VisionPro.Blob

  Private Sub doBlob()
  Dim myBlob As New CogBlob
  Dim myBlobResults As CogBlobResults
  Dim smallestPerimeter As Double
  Dim largestPerimeter As Double

  myBlob.SortEnabled = True
  myBlob.SortMeasure = CogBlobMeasureConstants.Perimeter
  myBlob.SortAscending = False
  myBlobResults = myBlob.Execute(mobjImage, r)

  TextBox1.Text = myBlobResults.GetBlobs.Count

  largestPerimeter = myBlobResults.GetBlobs.Item(0).Perimeter
  smallestPerimeter = myBlobResults.GetBlobs.Item(myBlobResults.GetBlobs.Count - 1).Perimeter

  MsgBox("Largest Perimeter: " + largestPerimeter + vbCr + " Smallest Perimeter: " + smallestPerimeter)
End Sub
 using Cognex.VisionPro; 
 using Cognex.VisionPro.Blob;

  private void doBlob()
{
CogBlob myBlob=new CogBlob();  
CogBlobResults myBlobResults; 
double smallestPerimeter; 
double largestPerimeter; 
myBlob.SortEnabled = true;
myBlob.SortMeasure = CogBlobMeasureConstants.Perimeter;
myBlob.SortAscending = false;
myBlobResults = myBlob.Execute(mobjImage, r);
textBox1.Text = myBlobResults.GetBlobs().Count.ToString();
largestPerimeter = myBlobResults.GetBlobs()[0].Perimeter;
smallestPerimeter = myBlobResults.GetBlobs()[myBlobResults.GetBlobs().Count - 1].Perimeter;
MessageBox.Show ("Largest Perimeter: " + largestPerimeter + "  Smallest Perimeter: " + smallestPerimeter);
}
See Also