Blob Detection
Introduction
A blob is a connected region that stands out from the pixels around it: a bright coin on a dark cloth, a dark hole on a light panel, a cell in a microscope image. Blob detection finds those regions and reports where they are, how big they are, and where their centres sit.
It does not, by itself, say "this is a cup". That naming step is object detection. Blob detection is the right tool when the part is already visually separate and you need a location. Many student pick-and-place setups start here, because a threshold and a region label are easier to explain than a trained detector.
What you are looking for
1 2 3 4 | |
The 1s form two blobs if "connected" means sharing an edge. From each blob you typically want:
| Measurement | Use |
|---|---|
| Area | reject specks and huge background leaks |
| Centre | a point to aim the robot at |
| Bounding box | a rectangle for a later crop or display |
| Brightness | bright-on-dark versus dark-on-bright |
The centre in pixels still has to be converted to robot coordinates. That step is vision-guided robotics.
In plain terms
Thresholding is a stencil that keeps the pixels unlike the background. Connected components are colouring each island of those pixels with its own id. The island's middle is where you point the gripper.
Thresholding
Thresholding turns a grayscale image into a binary image. Pick a cutoff T:
1 2 | |
Flip the test for a dark object on a bright field. T depends on the lamp and the camera exposure. A fixed T that works at noon fails when a window cloud passes. If the background is uneven, a single global T will eat one side of the image and miss the other. Then you need a local threshold, better lighting, or a background shot you subtract first.
1 2 3 | |
Look at binary before you trust the centres. If the part is merged with its shadow, no later labelling step can split them honestly.
Connected components
Connected-component labelling walks the binary image and gives each touching group of foreground pixels one id.
Two neighbourhoods are common:
| Neighbourhood | Touches when |
|---|---|
| 4-connected | shares an edge (up, down, left, right) |
| 8-connected | shares an edge or a corner |
Diagonal specks stay separate in 4-connected labelling and merge in 8-connected labelling. Pick one and keep it for the whole project.
Once each pixel has an id, a second pass sums the pixels of that id (area) and averages their coordinates (centre). Drop components outside an area range so a single noisy pixel is not a "part".
1 2 3 | |
That list is the input to a pick: sort by area or by x, take the first centre, transform it, move. Degrees of freedom tells you whether the arm can actually reach that point.
Other region finders
Threshold-and-label is the method to learn first. These names show up when the blob is a spot at a certain size, or when a single cutoff is unstable.
| Method | Idea |
|---|---|
| Laplacian of Gaussian (LoG) | Blur at a chosen scale, then look for spots where the second difference peaks. The scale matches the blob size you expect. |
| Difference of Gaussians (DoG) | Subtract two blurs of different size. The difference highlights blobs around that size. Cheaper stand-in for LoG, used in feature detectors. |
| Determinant of Hessian | A curvature test that responds to blob-like spots and is used in scale-invariant feature methods. |
| MSER | Sweep the threshold and keep regions whose shape barely changes over a range of cutoffs. More stable when lighting drifts. |
You do not need all four on a first prototype. Use them when a global threshold cannot separate the part, or when you must find the same blob at several sizes. Edge detection is the related tool when you need the boundary rather than the filled region.
Blob or detector
| Situation | Prefer |
|---|---|
| One bright part on a plain background | Threshold and connected components |
| You need area and centre, not a class name | Blob |
| Several object types in a cluttered scene | Object detection |
| You need the outline, not the fill | Edge detection |
A blob finder will happily return the highlight on the table. Constrain it with area, position in the image, and a known background. When the scene gets cluttered, move up to a detector that returns a class and a confidence, and keep the blob path for the simple cell.
Relevant topics
- Edge detection
- Object detection
- Vision-guided robotics
- Connected-component labeling (Wikipedia)
- Blob detection (Wikipedia)
Starting points
- Threshold a grayscale photo of one part on a plain background. Adjust
Tuntil the part is one solid region. - Count the foreground islands by hand on a 8×8 binary sketch, once with 4-connectivity and once with 8-connectivity.
- Compute area and centre for one island and reject a one-pixel island with an area limit.
- Write the rule that chooses which blob a gripper should approach (largest, leftmost, closest to the image centre).
Focus points
- Set the threshold from the image you have, under the lamp you will use. Re-check when either changes.
- Choose 4- or 8-connectivity and do not mix them between the lab and the robot.
- Filter on area. Tiny components are noise. A component the size of the frame is usually a bad threshold.
- The centre is in pixels. Calibrate before you treat it as a robot target.
- A blob has no class name. Add a detector when the scene contains more than "the region that stands out".
Key points
- A blob is a connected region that differs from its surroundings. Useful outputs are area, centre, and a bounding box.
- Thresholding makes a binary image. Connected components give each touching foreground group an id.
- 4-connected and 8-connected neighbourhoods decide whether diagonal pixels merge.
- LoG, DoG, Hessian, and MSER find regions when a single global cutoff or a fixed size is not enough.