loading

Blob Filter

The blob filter module (also known as Particle Filter or Analysis) provides a way to identify a particular blob based on features that describe aspects of the blob itself and in relation to other blobs. The purpose of the blob filter is to provide enough feature descriptions of the desired blob to ensure that the identification of a particular blob is reliable and dependable despite a noisy background.

The blob filter must be used after a blob segmentation module like the RGB Filter, Segment Colors, Flood Fill, Threshold, etc. modules that will group pixels in some meaningful way into blobs of a single color with black pixels being the background. The module you will use to perform this segmentation will depend on your particular project task. Once the image has been grouped into blobs this Blob Filter module is then used to remove or filter those blobs remaining in the image that are not wanted. For example, if you have an image that was detected for the red color using the RGB Filter module and the image included a red or orange cone the blob filter can be used to remove all blobs that are too small and not triangular shaped in the image. Thus any red dirt or tree bark while present after the red color detection would be removed by using the blob filter as they would fail a triangular shape test (assuming this is one of the attributes filtered on).

Once you have your image segmented into various blobs you then add in each blob attribute seen below and specify a weight threshold or count threshold to remove those unwanted blobs. Keep in mind that you can add multiple attributes one after the other that will remove blobs along the way in order to finish with the final desired blob. Look for attributes that create a wide distinction between your desired blob and other unwanted blobs (see the Show Weights checkbox to see all weights given the current attribute). Using the checkbox "Create Blob Array" will create the final BLOBS array variable that will contain the COG (center of gravity) of the blobs left after the filtering process. This variable can then be used to react to the presence of a particular object.

Interface

Instructions

1. Name - Name this blob filter for easy identification

2. Select the appropriate feature(s) and insert into the feature list

3. Select Count Threshold - Specify how many blobs should result after the filter (i.e. threshold blob count)

4. Select Weight Threshold - Specify the minimum weight of resulting blobs (i.e. threshold blob weight)

5. Create array variable - If you would like to get an array that shows how relevant the blob is to the current filter selection select this checkbox. A variable array will be created for each blob that indicates what weight that blob has towards the current filter criteria.

6. Invert Threshold / Invert Count - If you want to invert the selection (i.e. reverse the current selections) click on the invert selections. Thus if you had 1 big blob selected the invert will change that list to be all the blobs minus the one big blob.

7. Blob Color - Adjust how the resulting blobs should be colored after the module. "Actual" means no change in blob coloring, "Gray" will color each blob based on its final weight, i.e. higher weighted blobs will appear brighter than others. "Color" refers to labeling each blob with a different color so that they can easily be distinguished. "White" refers to creating a mask regardless of the current blob colors.

8. Show Weights - Click Show Weights to indicate each blob's final weight. If the image appears crowded you can either change the font size or just click on one of the blobs in the main RoboRealm image window to isolate the value printing for just that blob.

9. Largest is background - In the case of images that contain blobs that are not white there may be cases where the background is not perfectly black. When this happens you can select this checkbox to ensure that the largest blob is treated as the background and thus not reported as part of the active blobs.

10. Create BLOBS array - If you would like to create an array that contains the resulting center coordinates of all detected blobs (for use in other modules like the scripting modules) select the "Create BLOBS variable array". This creates a floating point array that contains the X and Y coordinates of the center of gravity of each blob that makes it through the filters. A second variable called BLOB_COUNT is also created that indicates how many blobs have passed through the filters. This value will be 1/2 the size of the BLOBS array (since the array has 2 entries per blob).

Blob Features

Note that for many comparisons the objects COG defines the point at which comparisons are made.

Source ImageFiltered Image

Color

RGB Closest to #FF0000 - Blob with color closest to specified color gets highest weight
Brightest - Blob with highest intensity gets highest weight
Brightness - Blob with intensity above specified weight is preserved (intensity is 0 - 255 corresponding to 0.0 - 1.0)
Darkest - Blob with lowest intensity gets highest weight
Darkness - Blob with intensity below specified weight is preserved (intensity is 0 - 255 corresponding to 0.0 - 1.0)
Brighter Than (150) - Blobs with lower intensity than that specified are removed
Darker Than (150) - Blobs with higher intensity than that specified are removed
Color Amount - Blobs with more color/hue regardless of which color are given higher weights
Red Amount - Blobs with more red are given higher weights
Green Amount - Blobs with more green are given higher weights
Blue Amount - Blobs with more blue are given higher weights
Gray Amount - Blobs with more less color are given higher weights
Saturation - Blobs with richer color are given higher weights
Most Common Intensity - Blobs with intensity most similar to the intensity mode are given higher weights
Color Variance - Blobs with most changes in color within the blob are given higher weights. Note this requires a mask to be used in the Blob Filter module otherwise different colors will be counted as isolated blobs. Use a mask to isolate blobs and refer back to the colored image.
Average Histogram - Blobs with a histogram (intensity distribution) most similar to the average histogram of all blobs are given higher weights. Note this requires a mask to be used in the Blob Filter module otherwise different intensities within a blob will be counted as isolated blobs. Use a mask to isolate blobs and refer back to the colored image.
Intensity Similar To Mean - Blobs with intensity most similar to mean intensity of all blobs gets highest weight

Proximity

Nearest - Blobs nearest to each other get high weights. You can also enter in (x,y) coordinates and variables using [] notation.
Nearest X - Blobs nearest to the specified X coordinate get higher weights. (70 in this example)
Nearest Y - Blobs nearest to the specified Y coordinate get higher weights. (60 in this example).
Nearer Than - Blobs nearer to other blobs by a specified amount are kept while the others are removed.
Furthest - Blobs furthest from each other i.e. most isolated will get higher weights. You can also enter in (x,y) coordinates and variables using [] notation.
Further Than - Blobs further than a specified amount from other blobs are kept, blobs too close are removed.
COG Nearer Than - Blobs with COG's nearer to other blob COG's by a specified amount are kept, others are removed.
COG Further Than - Blobs with COG's further than a specified amount from another blob's COG are kept, blobs with close COGs are removed.
Most Neighbors - Blobs with many close neighboring blobs will get higher weights
Least Neighbors - Blobs with no close neighbors will get higher weights
Touches Another - Blobs that touch other blobs (of different color/intensity) will get a weight of 1.0
Aligned Vertical - Blobs that are vertically aligned will get a height weight
Aligned Left - Blobs that are vertically aligned on the left side will get a height weight
Aligned Vertical Center - Blobs whose centers are horizontally aligned will get a height weight
Aligned Right - Blobs that are vertically aligned on the right side will get a height weight
Aligned Horizontal - Blobs that are vertically aligned will get a height weight
Aligned Top - Blobs that are vertically aligned will get a height weight
Aligned Horizontal Center - Blobs whose centers are vertically aligned will get a height weight
Aligned Bottom - Blobs that are vertically aligned will get a height weight

Location

Center - Blobs closest to the center of screen get higher weights
Horizontal Center - Blobs closest to the horizontal center only of screen get higher weights
Vertical Center - Blobs closest to the vertical center only of screen get higher weights
Outward - Blobs furthest from center (closest to screen border) get higher weights
Top - Blobs closest to the top of screen get higher weights
Bottom - Blobs closest to the bottom of the screen get higher weights
Left - Blobs closest to the left of the screen get higher weights
Right - Blobs closest to the right of the screen get higher weights
Top Left - Blobs closest to the top left of screen get higher weights
Top Right - Blobs closest to the top right of screen get higher weights
Bottom Left - Blobs closest to the bottom left of screen get higher weights
Bottom Right - Blobs closest to the bottom right of screen get higher weights
Above - Blobs above their closest neighbor get higher weights
Below - Blobs below their closest neighbor get higher weights
LeftOf - Blobs to the left of their closest neighbor get higher weights
RightOf - Blobs to the right of their closest neighbor get higher weights
AboveY (50) - Blobs above the specified Y coordinate are kept, those below are removed
BelowY (50) - Blobs below the specified Y coordinate are kept, those above are removed
LeftOfX (80) - Blobs left of the specified X coordinate are kept, those right of X are removed
RightOfX (80) - Blobs right of the specified X coordinate are kept, those to the left are removed
Between - Blobs between close neighboring blobs get higher weights
Within (top 3) - Blobs located within other blobs get higher weights
Around (top 3) - Blobs surrounding other blob get higher weights
Overlaps - Blobs overlapping blobs in other Object tabs are preserved
Inner - Only blobs located within other blobs are kept
Outer - Only blobs surrounding other blobs are kept
Touches Border - Only blobs that touch the image border are kept
Touches Bottom Border - Only blobs that touch the bottom image border are kept
Touches Top Border - Only blobs that touch the top image border are kept
Touches Left Border - Only blobs that touch the left image border are kept
Touches Right Border - Only blobs that touch the right image border are kept
Avoids Border - Only blobs that do not touch (but avoid) the image border are kept. I.e. objects completely contained within the current image.
Avoids Bottom Border - Only blobs that do not touch (but avoid) the bottom image border are kept.
Avoids Top Border - Only blobs that do not touch (but avoid) the top image border are kept.
Avoids Left Border - Only blobs that do not touch (but avoid) the left image border are kept.
Avoids Right Border - Only blobs that do not touch (but avoid) the right image border are kept.

Size

Size Similar To - Blobs closest to specified size have higher weights
Size Similar To Mean - Blobs closest to the mean blob size have higher weights
Size Similar To Median - Blobs closest to the median (middle) blob size have higher weights
Most Common Size - Blobs with similar sizes to other blobs get higher weights. This allows for multiple common sizes to exist.
Smallest (above 0.98) - Smaller blobs get higher weights
Largest (top 1) - Larger blobs get higher weights
Bigger Than (200) - Blobs bigger than the specified size are kept, those below are removed
Smaller Than (10) - Blobs smaller than the specified size are kept, those above are removed
AtLeast 100 (top 10) - Blobs above the specified amount get decreasing weights according to their size
AtMost 100 (top 10) - Blobs smaller than the specified amount get decreasing weights according to their size
Widest (0.10) - Wider/thicker blobs (horizontal size) get higher weights
Narrow (top 10) - Narrow/thinner blobs (horizontal size) get higher weights
Wider Than (10) - Blobs thinner than the specified amount are removed
Narrower Than (10) - Blobs wider than the specified amount are removed
Taller Than (10) - Blobs shorter than the specified amount are removed
Shorter Than (10) - Blobs taller than the specified amount are removed
Tallest (top 10) - Taller blobs (vertical size)
Shortest (top 5) - Shorter blobs (vertical size) get higher weights
Thickest (top 3) - Thicker blobs (minimum distance from object perimeter to medial axis) get higher weights
Thinnest (top 3) - Thinner blobs (minimum distance from object perimeter to medial axis) get higher weights
Constant Thickness - Blobs with more constant thickness get higher weights.

Texture

Gradient (270 degrees) - Blobs with specified surface gradient (shading) get higher weights
Gradient Strength - Blobs with weight by their surface gradient (shading) strength
Number of holes (4) - Blobs with specified number of holes are kept, the others are removed
Hole Size (100) - Blobs with specified hole size get higher weights
Most Holes (top 4) - Blobs with many holes (regardless of hole size) get higher weights
At Most Holes (0) - Blobs with at most the specified number of holes get higher weights
Least Holes (top 4) - Blobs with fewest holes (regardless of hole size) get higher weights
At Least Holes (1) - Blobs with at least the specified number of holes get higher weights
Hole Bigger Than (50) - Blobs with a hole bigger than the specified amount get higher weights
Hole Smaller Than (50) - Blobs with a hole smaller than the specified amount get higher weights
Densest - Blobs that are more solid (least or smallest holes) get higher weights
Least Densest - Blobs that are least solid (many or few large holes) get higher weights.
Density Ratio - Blobs that are the specified density ratio (area of blob versus hole) get higher weights.
Orientation - Blobs that are oriented in the specified degree will get higher weights.
Orientation Strength - Blobs that have a strong orientation will get higher weights.
Contrast - Blobs that have a stronger contrast will get higher weights.
Roughest - Blobs that have more texture (based on the specified image) than other blobs get higher weights
Roughness - Blobs are weighted based on roughness as an absolute value
Smoothest - Blobs that have less texture (based on the specified image) than other blobs get higher weights
Smoothness - Blobs are weighted based on smoothness as an absolute value
Variance - Blobs are weighted based on variance of pixel intensities relative to mean intensity of the blob
Center Mean Ratio - Blobs are weighted based on the difference between the center pixel and the average intensity of the blob

Shape

Aspect (1.0) - Blobs with the specified aspect ratio (width/height) get higher weights
Boxed - Blobs that best fit their square bounding box get higher weights
Circular Area - Circular blobs get higher weights
Circular Deviation - Blobs with circular perimeters (ignoring holes) get higher weights
Circular perimeter - Blobs with circular perimeters (ignoring holes) get higher weights
Perimeter / Area - Calculates perimeter / area ratio for each blob
Area / Perimeter - Calculates area / perimeter ratio for each blob
Area / (Perimeter ^ 2) - Calculates area / (perimeter*perimeter) ratio for each blob
Quadrilateral Sides - Estimates a perfect rectangle from blob outline and then determines squareness of a blob by comparing how well two sides of the ideal extracted rectangle compare in length. The more rectangular the blob the more the opposing sides will match in length
Quadrilateral perimeter - Estimates a perfect rectangle from blob outline and then compares how the blob's perimeter matches the perimeter determined by the ideal four sides
Quadrilateral Area - Estimates a perfect rectangle from blob outline and then compares how well does the blob's area matches the area determined by the ideal four sides
Quadrilateral Deviation - Estimates a perfect rectangle from blob outline and then compares how well does the blob's outline deviates from the ideal extracted rectangle
Squareish - Blobs appearing like a square (perimeter is 4*side) get higher weights
Smoothness - Blobs with smooth perimeters get higher weights
Straightest (top 5) - Blob shape is mainly in a single direction
Triangular - Triangular shaped blobs get higher weights based on how well their area and perimeter agree based on a triangle
Triangle Sides - Estimates a perfect triangle from blob outline and then determines triangularness of a blob by comparing how well sides of the ideal extracted triangle compare in length
Triangle perimeter - Estimates a perfect triangle from blob outline and then determines how well does the blob's perimeter matches the perimeter determined by the ideal three sides
Triangle Area - Estimates a perfect triangle from blob outline and then determines how well does the blob's area matches the area determined by the ideal three sides
Triangle Deviation - Estimates a perfect triangle from blob outline and then determines how well does the blob's outline deviates from the ideal extracted triangle
Bitmap using - Blobs most similar to shape bitmap get higher weights

Moments of Inertia

Axis Aspect (1.0) - Blobs with the specified aspect ratio (minor axis/major axis) get higher weights
Eccentricity - ratio of the distance between the foci of the ellipse representation of the image and its major axis length
Invariant_1 - the first Hu invariant centralized moment
Invariant_2 - the second Hu invariant centralized moment
Normalized_02 - the 02 scale invariant centralized moment
Normalized_20 - the 20 scale invariant centralized moment
Normalized_03 - the 03 scale invariant centralized moment
Normalized_30 - the 30 scale invariant centralized moment
Normalized_11 - the 11 scale invariant centralized moment
Normalized_12 - the 12 scale invariant centralized moment
Normalized_21 - the 21 scale invariant centralized moment
Kurtosis_X - a measure of the "peakedness" of the blob shape along the X Axis
Kurtosis_Y - a measure of the "peakedness" of the blob shape along the Y Axis
Skewness_X - a measure of the asymmetry of the blob shape along the X Axis
Skewness_Y - a measure of the asymmetry of the blob shape along the Y Axis
Variance_X - variance around the object center given the appropriate axis
Variance_Y - variance around the object center given the appropriate axis
Variance_XY - variance around the object center given the appropriate axis

Edge

Strength - Calculates how strong the blobs edges are using the specified source image. This is a measure of how stable the shape of the blob is
Spiked - Calculates how unsmooth the edge of the blob is. This is done by determining how many pixels belong to a straight edge (vertical, horizontal or diagonal).
Grittiness - Similar to Spiked but eliminated overlapping count of edge shape.
Variance - Calculates a measure of how different the source pixels of the blob are to their average along the blob edge.

Orientation

Diagonal - Diagonal oriented blobs get higher weights
Diagonal Left - Left slanted blobs get higher weights
Diagonal Right - Right slanted blobs get higher weights
Horizontal - Horizontal oriented blobs get higher weights
Max Radius Degree - Determines furthest point in blob from COG of blob and then ranks blobs based on the angle of the line from the COG to that furthest point (45 degrees)
Degree Range - Filters out blobs that do not fall within the specified orientation range.
Triangle Degree - Estimates a perfect triangle from blob outline and then ranks then based on the triangle's orientation (45 degrees)
Vertical - Vertical oriented blobs get higher weights

Other

Join - Used to ensure that an objects detected in one tab filter are also detected in another. Can be used to join blobs across tab filters.

Examples

Source ImageFiltered (In Red)
 Download the robofile used to find the gas icon.
 Download the robofile used to find the oil icon.
 Download the robofile used to find the battery icon.
 Download the robofile used to find the fluid icon.

Variables

BLOBS - contains the COGX and COGY of all detected blobs. You can use this array within a VBScript program to further process the blobs. For example, the below script will calculate the distance to the first two detected blobs. Note that the blob filter should allow at least two blobs to exist for this script to work correctly.

BLOB_FILTER_START_COUNT - the number of blobs entering into the blob filter module.

BLOB_FILTER_END_COUNT - the number of blobs remaining after all filters are applied

blobs = GetArrayVariable("blobs")

if isArray(blobs) then
  if ubound(blobs) >=2 then

    xdiff = blobs(0)-blobs(2)
    ydiff = blobs(1)-blobs(3)

    dist = sqrt((xdiff*xdiff) + (ydiff*ydiff))

    SetVariable "distance", dist

  end if
end if

See Also


Blob Size
Blob Inspection
Shape Match


 New Post 

Blob_Filter Related Forum PostsLast postPostsViews
Blob filtering
I would like to filter blobs so that remained only those that are further at least 30px from those blobs that touch the edges of...
7 year 4 2376
Recognition of B/W Laserscan Targets
Hi all, I am completly new at Roborealm. My current task is to recognice the center of Black&White ...
7 year 2 2385
Robot tracking Robot
Hey guys, This past year I built an outdoor robot that follows a buried wire around the property. I...
8 year 4 2815
C# Sample Project
Has anyone created a simple C# Form Application for RGB Filter? Not really able to follow the sample project that I downloaded a...
9 year 4 3073
Test Module
(Sorry, this belongs to test module, but I cannot select it, therefore the post will probably not show up there. No posts there ...
9 year 2 2694
Blobs
Hi Steven, I have a outdoor camera that pans quite a large area and looks for boats at anchor after...
9 year 4 2651
traffic light detection
hi everyone, i want to use webcam to  detect the green light, yellow light, red light and then give the...
9 year 9 4016
GetVariable("BLOB_COUNT") returns null
Hi, I am trying to use BLOB_COUNT with filters to check that there is nothing of a certain colour, ...
9 year 2 2948
Blob filter explanation
STeven, Two questions: * can you explain the meaning of the Object1, Object 2 tabs an...
10 year 2 3035
Finding small objects in grass
Hi STeven, I have attached a .robo file that includes a picture of a grassy lawn with two objects s...
10 year 5 3200
Edge probe issues
Hi! I'm having some issues with the edge probe module. I have three sequential probes (with differ...
10 year 12 3372
Blobs: Perimeter/area and blob size
Hi, I notice that the weights generated from perimeter/area and from area/perimeter change with the size of the blob as much as ...
10 year 2 3266
PCB pads detect
My first look to this program... It is very interesting! As you suggest to post pictures in the tutorial, I send t...
10 year 3 2922
Bug in nearest y
Hi STeven, When i put a variable, it keeps resetting to zero. The file is just an example....
11 year 2 2785
Nearest blob to refference line
Hi STeven, As an alternative to the nearest blob to a reference point, is it possible to find the n...
11 year 3 2813
Blob filtration based on logic
Hi STeven, Is it possible to filter blobs based on logic rather then priority? For example in the a...
11 year 3 2899
using weights
Hi, I´m using the blob filter module to give a blob the highest weight. Now, the blob with the high...
11 year 2 2760