FindBlobs
FindBlobs is used to filter and sort the blobs returned in a Blobs data structure.
Using the FindBlobs parameter settings, a formula is created that calculates a score to measure how closely the blobs referenced in the Blobs data structure match an “ideal” blob. Based upon the parameter settings, FindBlobs will in turn return only those blobs that match the specified requirements.
Each blob in the referenced Blobs data structure undergoes a two-step process of analysis: First, each of the individual FindBlobs parameter settings creates a formula that evaluates that particular parameter value. For instance, the Angle score would be computed by dividing the differences of the Range and the Angle parameter's Angle value and the Range and referenced blob's Angle value, multiplied by the Weight value. After the individual scores have been computed, each of the individual parameter scores are added together and divided by the sum of the individual Weight parameter values. This score is then compared against the Accept Thresh value to determine whether or not the blob meets the specified requirements.
Once FindBlobs has filtered and sorted the extracted blobs, a new Blobs data structure and accompanying result table will be automatically inserted into the spreadsheet. The result table is sorted by how closely the found blobs match the configured requirements, in descending order.
FindBlobs can be extremely useful in classifying features for defect detection. For example, if the job were to detect scratches on a surface, FindBlobs could be configured to return only those blobs with higher Elongation values. Or, if the goal was to detect jagged edge defects, FindBlobs could be configured to return only those blobs with higher Perimeter or Spread values.
FindBlobs Inputs
Syntax: FindBlobs(Blobs,NumbertoFind,AcceptThresh,Angle.Angle,Angle.Range,Angle.Weight,Area.Area,Area.Range,Area.Weight,Elongation.Elongation,Elongation.Range,Elongation.Weight,Holes.Number,Holes.Range,Holes.Weight,Perimeter.Perimeter,Perimeter.Range,Perimeter.Weight,Spread.Spread,Spread.Range,Spread.Weight,Show)
Parameter | Description | ||||||
---|---|---|---|---|---|---|---|
This parameter references the spreadsheet cell that contains the Blobs data structure that is to be filtered and sorted. For more information, see Cell References - Relative/Absolute. |
|||||||
This parameter specifies the maximum number (1 to 4096; default = 3) of blobs to return. If there are more blobs in the image whose scores exceed the Accept Thresh setting, the blobs with the highest scores will be selected. Note: If the value
of the Number
to Find parameter
is greater than zero, FindBlobs will automatically insert a result table
containing a maximum of 10 entries
that correspond to the first 10 blobs in the Blobs data structure.
If you wish to display more entries, you can expand the table by copying
the last row and pasting additional rows at the end; make sure to increment
the index number of any newly-pasted row so that the proper blob is indexed.
|
|||||||
Specifies the minimum acceptable match score (0 to 100; default = 10). FindBlobs will return only those blobs with match scores exceeding the Accept Thresh. The match score is computed with the following formula: (Angle score + Area score + Elongation score + Holes score + Perimeter score + Spread score) * (100/Sum of the parameters' Weight values) |
|||||||
This parameter is used to configure the scoring formula that identifies the ideal Angle score of found blobs.
|
|||||||
This parameter is used to configure the scoring formula that identifies the ideal Area score of found blobs.
|
|||||||
This parameter is used to configure the scoring formula that identifies the ideal Elongation score of found blobs.
|
|||||||
This parameter is used to configure the scoring formula that identifies the ideal Holes score of found blobs.
|
|||||||
This parameter is used to configure the scoring formula that identifies the ideal Perimeter score of found blobs.
|
|||||||
This parameter is used to configure the scoring formula that identifies the ideal Spread score of found blobs.
|
|||||||
Specifies the display mode for FindBlobs graphical overlays on top of the image.
|
FindBlobs Outputs
Returns |
A Blobs data structure containing the matching blobs sorted by score, or #ERR if any of the input parameters are invalid. |
When FindBlobs is initially inserted into
a cell, a Note: If the value
of the Number
to Find parameter
is greater than zero, FindBlobs will automatically insert a result table
containing a maximum of 10 entries
that correspond to the first 10 blobs in the Blobs data structure.
If you wish to display more entries, you can expand the table by copying
the last row and pasting additional rows at the end; make sure to increment
the index number of any newly-pasted row so that the proper blob is indexed.
|
FindBlobs Vision Data Access Functions
The following Vision Data Access functions are automatically inserted into the spreadsheet to create the FindBlobs Blobs data structure result table:
Spreadsheet Name |
Function Name |
Description |
---|---|---|
Row |
GetRow(Blobs, Blob Index) |
Returns the y-coordinate (Row) of the referenced blob's center of mass (centroid). |
Col |
GetCol(Blobs, Blob Index) |
Returns the x-coordinate (Column) of the referenced blob's center of mass (centroid). |
Angle |
GetAngle(Blobs, Blob Index) |
Returns the angle of the referenced blob's center of mass, relative to the center of the ROI. |
Color |
GetColor(Blobs, Blob Index) |
Returns the color value (0 = black, 1 = white) of the referenced blob. |
Score |
GetScore(Blobs, Blob Index) |
A measure of how closely the blob matches the criteria of a FindBlobs function. |
Area |
GetArea(Blobs, Blob Index) |
Returns the area of the referenced blob (measured in pixels). Note: If there are
holes in the blob, the Area value
will vary depending on whether or not the Fill Holes checkbox is enabled
or disabled. For more information, see Fill Holes.
|
Elongation |
GetElongation(Blobs, Blob Index) |
Returns a value that represents how the referenced blob's pixels are stretched out from the blob's center of mass (centroid). For instance, a circle would report 0 Elongation, while a nail would have a high Elongation value. |
Holes |
GetHoles(Blobs, Blob Index) |
Returns the number of holes contained within the referenced blob. |
Perimeter |
GetPerimeter(Blobs, Blob Index) |
Returns the length of the boundary around the referenced blob; the perimeter is calculated by counting the external edges of the pixels that form the boundary of the blob. |
Spread |
GetSpread(Blobs, Blob Index) |
Returns a value that represents how the referenced blob's pixels are distributed away from the blob's center of mass (centroid). For instance, a circular shaped object would have a lower Spread value than an oval shaped object. |
Additional data elements can be accessed using the following Vision Data Access functions:
Thresh |
GetThresh(Blobs) |
The Threshold value that was used to segment the image. |
NFound |
GetNFound(Blobs) |
The number of blobs found. |
MinRow |
GetMinRow(Blobs, Blob Index) |
Returns the topmost row coordinate for a square bounding box around the referenced blob, oriented to the image coordinate frame. Note: For an alternative
bounding box, with a varied orientation, please refer to the BoundingRectangle
function. For more information, see BoundingRectangle.
|
MinCol |
GetMinCol(Blobs, Blob Index) |
Returns the leftmost column coordinate for a square bounding box around the referenced blob, oriented to the image coordinate frame. Note: For an alternative
bounding box, with a varied orientation, please refer to the BoundingRectangle
function.
|
MaxRow |
GetMaxRow(Blobs, Blob Index) |
Returns the bottommost row coordinate for a square bounding box around the referenced blob, oriented to the image coordinate frame. Note: For an alternative
bounding box, with a varied orientation, please refer to the BoundingRectangle
function.
|
MaxCol |
GetMaxCol(Blobs, Blob Index) |
Returns the leftmost column coordinate for a square bounding box around the referenced blob, oriented to the image coordinate frame. Note: For an alternative
bounding box, with a varied orientation, please refer to the BoundingRectangle
function.
|
FindBlobs Example
The FindBlobs function is used to filter and sort the blobs returned in a Blobs data structure. This example will help to illustrate how the FindBlobs parameter settings can be set to examine a list of blobs, and only return those blobs that match a specified ideal.
A
FindBlobs function was inserted into the spreadsheet, which will automatically
launch the FindBlobs property sheet.
For the purposes of this example, the blobs are being examined and the
parameters are being set to return only those blobs with 0 holes
in them, regardless of any other criteria.
Based upon these requirements, the FindBlobs parameters would be configured as follows:
- Blobs: This parameter was set as an absolute cell reference to the previously created DetectBlobs Blobs data structure.
- Number to Find: This parameter was set to 1, because the image contains only one such blob. Had this parameter been set higher, the cells below the one returned blob would have been #ERR.
-
Accept Thresh: The default setting was used. By using this setting in situations where there is less certainty in regards to the blobs, the lower the threshold guarantees that more blobs will be returned, though their similarity to the ideal decreases.
Because the blobs are being examined to return only blobs with 0 holes in them, the only parameter that will need to be configured is the Holes parameter. All the other blob properties parameters will be left at their default settings, except for their Weight settings, which will be set to 0.
- Holes:
In this instance the Holes Number value is set to 0, while
the Range value is reduced to
0 and the Weight is set to 100.
This guarantees that only those blobs in the Blobs data structure
with 0 will be returned in the resulting FindBlobs Blobs data structure and
result data table.
For more information, see Blobs, DetectBlobs, ExtractBlobs, and SortBlobs.