You are on page 1of 18

Blob

Session 6

Objectives
• The student will correctly:

 Identify applications where a Blob tool may be part of a vision


solution
 Create and configure a blob tool that
 Finds blobs in a designated grey-level range
 Filters blobs based on given criteria

1
Blob Overview
• Blob analysis is the detection and analysis of two-dimensional
shapes within an image
• Blob finds objects by identifying groups of pixels that fall into a
user-defined grey-scale range
• Blob reports many properties: center of mass (CM) extrema

– Area
– Center of Mass
– Perimeter
principal axes (PA)
– Principal Axes extrema

CM

PA

When to Use Blob


• Blob analysis is well-suited for applications where:
– Objects vary greatly in size, shape, and/or orientation (Difficult or impossible to
train a model)
– Objects are of a distinct shade of grey not found in the background
– Objects are not overlapping or touching

• Sample applications:
– Inspect for number, size, and shape of dispensed epoxy dots
– Inspect for correct position and size of ink dots indicating bad wafer dies
– Inspect for fragmentation and size of pharmaceutical tablets
– Sort or classify objects according to their size, shape, or position

2
Segmentation
• The first thing Blob does when it Blob pixels
runs is image segmentation,
determining which pixels are
blob pixels and which are
background pixels
• There are several modes to
specify what separates blob
from background pixels

Background pixels

Segmentation
• Most segmentation modes
will require:
– Polarity
• Dark blobs on light
• Light blobs on dark
– Threshold
• The value(s) that
separate blob pixels
from background
pixels

3
Fixed Thresholding
• In Fixed Thresholding, the division between blob pixels and
background pixels is determined by grey values.
• Set a grey-level threshold:

grey value
p threshold
i = 140
x
e
l
s

0 blob background 255


grey-values

Fixed Thresholding
• Fixed grey-level 90
thresholds do not Dark image: Pixel
value 10
Threshold = 100
accommodate linear
lighting changes
Average Pixel 160
image: value 80
Threshold = 100

Pixel 200
Light image: value 120
Threshold = 100

4
Relative Thresholding
• Relative thresholds are expressed as percentages of the total pixels between
the left and right tails
• Tails represent noise-level pixels that lie at the extremes of the histogram

Image:
Histogram:

5% of pixels with 40% of 5% of pixels with


lowest values highest values

Right tail pixel value


Left tail pixel value Threshold pixel value

Using Relative Thresholds


• Relative
thresholds
Threshold = 30
adjust for linear
lighting 40% of

changes
Threshold = 100

40% of

Threshold = 140

40% of

10

5
Fixed vs. Relative Thresholding
• Fixed is faster than relative because the grey levels
corresponding to the percentages do not have to be
computed
• Fixed thresholding can test for absence of a feature in a
scene, whereas relative thresholding will always find a blob in
the scene
background "object"

0 255

left tail grey level grey level right tail


with with
weight 0 weight 1.0

11

Hard Thresholding
• The examples so far have all used Hard Thresholding
– One value (grey level or percentage) divides blob pixels from
background pixels

200

Pixel
value
{ 220
80
100
120
Apply threshold value = 150

grey value
threshold
Examine a histogram to
determine the threshold
grey value blob background

12

6
Hard Thresholding
Threshold Specify single
dynamically percentage & tails
chosen; good for
images with
bimodal
distribution of
grey values Specify single
grey value

13

Spatial Quantization Error


• Occurs with hard thresholding when
the object falls differently on the pixel
grid from image to image

• May result in erroneous results for


blob size, perimeter, and location
Pixels in object = 64 Pixels in object = 81

• Error becomes more pronounced as


the perimeter of the object increases

Pixels in object = 44 Pixels in object = 25

14

7
Pixel Weighting
• Spatial Quantization Error can be eliminated by applying pixel
weighting
• As the blob moves relative to the pixel grid, the total weight
remains the same

0 0 1 1 1 0 0 0 .4 1 1 .6 0 0 0 0 .8 1 1 .2 0

Total area = 3 Total area = 3 Total area = 3

15

Soft Thresholding
• Soft Thresholding
example 1.0

– Low Threshold = 50
– HighThreshold = 65 0.75

– Softness = 3
0.50
Weighting

0.25

50 55 60 65

Threshold Grey
Values High
Threshold

16

8
Soft Thresholding

Uses grey values


for thresholds Uses percentages for
thresholds and tails

17

Using a Subtraction Image


• Use a Subtraction Image when the image
consists of similar background and blob
grey values
Subtraction Image
• The threshold image contains only
background information
• Every pixel in the image that differs from the
corresponding pixel in the threshold image
by a specified amount is a blob pixel Image to Segment

Segmented Image

18

9
Pixel Mapping
• Use a pixel map (lookup table) for images that cannot be
segmented with hard or soft binary thresholds
• Requires a scaling factor which gets applied to the pixel map
values

19

Pixel Mapping
• Supply an output value for each
grey value

20

10
Connectivity Analysis
• After segmenting the image, Blob
performs Connectivity Analysis
• Whole Image blob analysis returns
one result for all blob pixels in the
image
• Grey Scale analysis identifies
discrete, connected blobs Whole Blob Analysis

Grey Scale Analysis

21

Connected-Blob Analysis
• Object pixels must be eight-connected
– Connected vertically, horizontally, or diagonally
• Background pixels are four-connected
– Connected vertically or horizontally only

How many blobs are in


this Image?
22

11
Applying Morphological Filters
• First choose the filter(s) from the pull-
down list

• Order matters!
– To reorder or delete an operation, use
the buttons in the dialog

23

Pruning and Filling


• Pruning ignores, but does not remove, features which are
below a specified size
• Filling fills in pruned features with grey values from
neighboring pixels on the left

Initial image Pruned image Filled image

1 b lob enclosing 9 holes 1 b lob enclosing 1 hole 1 b lob enclosing 1 hole


Blob area = 900 Blob area = 900 Blob area = 980

Holes still exist,


but are not reported Holes are filled in

24

12
Region
• By default, the blob analysis
is done on the entire image
• To only detect blobs in a
portion of the acquired image
use a Region Shape
– May graphically position and
size on the Input Image

25

Measurements
• Allows you to specify
measurements
calculated on each blob

26

13
Measurements
• For each selected
measurement, choose:
– Grid
– Runtime
– Filter

27

Measurements
• Use Filter to exclude
blobs outside a
certain range for any
property
– Or include only in a
certain range

28

14
Measurements
• Results may be sorted in order for
any of the selected measurements
– Ascending or descending order

29

Graphics
• Choose to display Result or
Diagnostic graphics
– Remember that graphics add
time

30

15
Results
•N
– Index of the blob

• ID
– A unique blob identification number independent of sorting criteria

• Measurements
– Calculated for those selected measurements

31

Geometric Properties
• Geometric properties are blob measurements that are constant
regardless of the orientation of the blob
– Area
– Perimeter
– Center of Mass
– Second moments of
inertia about the Bounding box for
Geometric extents
principle axes Center of mass
– Geometric extents
Minor axis
– Principal bounding box
Major axis

32

16
Non-geometric Properties
• Non-geometric properties are those that change as the blob
rotates or changes position
– Blob median
– Second moment of
inertia about the
coordinate axes
– Coordinate extents
Bounding box for
– Arbitrary bounding Coordinate extents

box Median in y-axis

Blob median

Median in x-axis

33

Topological Properties
• Identifies blobs, holes, and blobs within holes

34

17
Summary
• The Blob tool plays an important role in machine vision
• The Blob tool is used in key situations where:
– A model may be difficult to train
– A very specific measurement like area or acircularity is necessary

35

18

You might also like