Skip to content
Tactiverge

When vision fails

Lighting changes, occlusion, motion blur and soft, shape-changing objects all break simple vision. See each failure in numbers, and why robots combine vision with other senses.

Lesson 6 of 6 · 40 min · Self-paced · Free

A good engineer knows the limits

The previous lessons built a working pipeline: threshold an image, find connected regions, measure their centroids and turn pixels into positions. In a controlled test, it can work beautifully. Then the robot is moved to a new room, or the object starts moving, or a gripper finger gets in the way, and it fails.

Knowing how a sensor fails is as important as knowing how it works, because it tells you what to test, what to warn users about and what other sensors you might need. This lesson takes four common failure modes and shows each one in numbers.

Failure 1: lighting

Here is the image from the thresholding lesson, with the same threshold of 100, under steadily dimmer light:

image = [
    [ 30,  35,  32,  40,  38,  33],
    [ 36, 180, 190,  41,  37,  35],
    [ 31, 185, 200, 195,  39,  34],
    [ 38, 176, 188, 192,  42,  36],
    [ 33,  37,  40,  36,  35,  31],
]

def count_above(img, t):
    return sum(1 for row in img for v in row if v > t)

for gain in [1.0, 0.7, 0.55, 0.5]:            # 1.0 = original lighting
    dimmer = [[round(v * gain) for v in row] for row in image]
    print(f"light x{gain}: {count_above(dimmer, 100)} object pixels")

Output:

light x1.0: 8 object pixels
light x0.7: 8 object pixels
light x0.55: 6 object pixels
light x0.5: 0 object pixels

Down to 70% of the original light, nothing changes. At 55%, two pixels drop out and the object appears smaller, which would shift its centroid and its size-based distance estimate. At 50%, the object vanishes completely. The failure is not gradual and polite: the system goes from perfect to useless over a small change. Halving the light is easy to do by accident, for example when a cloud passes a window or someone stands between the lamp and the table.

Shadows, reflections and glare cause related problems. A shiny object can show a bright highlight that is the colour of the lamp, not the object. HSV helps with gentle brightness changes, as the colour lesson showed, but not with very dark pixels, glare or coloured light.

Failure 2: occlusion

Occlusion means part of the object is hidden behind something else. For a robot grasping an object, the most common thing in the way is the robot's own gripper.

def centroid(pixels):
    n = len(pixels)
    return (sum(p[0] for p in pixels) / n, sum(p[1] for p in pixels) / n)

# A 4 x 4 object occupying rows 2-5 and columns 2-5
full = [(r, c) for r in range(2, 6) for c in range(2, 6)]
# The same object with its right half hidden behind a gripper finger
visible = [(r, c) for (r, c) in full if c < 4]

print("Full object centroid:   ", centroid(full))
print("Half-hidden centroid:   ", centroid(visible))

Output:

Full object centroid:    (3.5, 3.5)
Half-hidden centroid:    (3.5, 2.5)

The object has not moved at all, but its measured centroid jumped a whole pixel column to the left, because the code can only average the pixels it can see. Worse, the error appears exactly when it matters most: as the gripper closes in, it hides more of the object. With heavier occlusion, the region may split into two pieces or disappear. The camera's view is intermittent: present some of the time, missing or misleading at other times.

Failure 3: motion blur

A camera's shutter stays open for a short exposure time. If the object moves during that time, it smears across the image. Using the pinhole model, an object moving sideways at speed v, at distance Z, moves across the image at f · v / Z pixels per second, so the smear is:

f = 600.0            # focal length, pixels
Z = 1.0              # distance to the object, metres
exposure = 1 / 60    # seconds the shutter is open

for speed in [0.05, 0.5, 2.0]:          # object speed across the view, m/s
    blur_px = f * speed * exposure / Z
    print(f"{speed:4.2f} m/s -> smeared over {blur_px:4.1f} px")

Output:

0.05 m/s -> smeared over  0.5 px
0.50 m/s -> smeared over  5.0 px
2.00 m/s -> smeared over 20.0 px

A slowly sliding object is fine. At half a metre per second, which is a gentle arm movement, edges are smeared over five pixels: the edge detector's response weakens, thresholds give ragged regions, and size measurements grow in the direction of motion. Shorter exposures reduce blur but let in less light, which brings back Failure 1. There is also latency: by the time an image has been captured, processed and acted on, the world has moved on.

Failure 4: deformable objects

Everything so far assumed a rigid object with a fixed shape. Many real objects are not: cloth, cables, food, bags, sponges. A towel lying flat and the same towel crumpled have completely different areas, outlines and centroids. A known-size distance estimate is meaningless when the size keeps changing. And when a gripper squeezes a soft object, the most important information, such as how much it has compressed, whether it is slipping, or how hard the fingers are pressing, may be invisible to a camera altogether, hidden inside the grasp.

Why robots add other senses

None of these failures means vision is a poor sensor. It gives rich, absolute information about where things are, at a distance, without touching. But it is weak exactly where a grasp happens: close up, partly hidden and in contact. So robots usually combine vision with other sensors that fail in different ways: joint encoders and wheel odometry that are always available but drift, force and touch sensors at the fingertips that feel contact directly, and depth sensors that measure distance. Combining them is called sensor fusion.

The explorer below shows the idea with two imperfect sensors tracking a moving point. The camera is accurate but drops out in bursts, like an occluded view. Odometry never drops out but slowly drifts.

Explorer 03 — Sensor fusion

Two imperfect sensors, one better estimate

POSITION (cm)NO VIEWNO VIEWNO VIEW-40-200204002468101214161820TIME (s)
  • True position
  • Camera reading
  • Odometry dead-reckoning
  • Fused (Kalman)
  • ±2σ uncertainty
  • Camera dropout

Camera · absolute, drops out

3.0 cm
25 %

Long-run share of time with no view, in bursts of about 1.2 s (occlusions).

Odometry · relative, drifts

4.0 cm/s
1.5 cm/s

A constant error in measured speed: its position estimate drifts by bias × time.

More controls
Fusion method

The Kalman filter weights each sensor by its stated noise, tracks its own uncertainty, and estimates the odometry bias while the camera can see.

Show

Root-mean-square error vs truth · lower is better

  • Camera aloneholds last reading in dropouts7.9 cm
  • Odometry alonedead reckoning from start15.1 cm
  • Kalman filterfused estimate0.9 cm
  • Fused, in dropoutsonly samples with no camera1.1 cm

Camera coverage 60 %. Camera error only over frames it saw: 2.9 cm (≈ its σ).

State

Seed 7. The camera saw the target 60 % of the time in 4 dropouts. Error (RMSE): camera alone 7.9 cm holding its last reading, odometry alone 15.1 cm, kalman filter 0.9 cm (1.1 cm during dropouts). Fusion is 88 % better than the better single sensor. Estimated odometry bias 1.53 cm/s (true 1.50).

Seed 7. The camera saw the target 60 % of the time in 4 dropouts. Error (RMSE): camera alone 7.9 cm holding its last reading, odometry alone 15.1 cm, kalman filter 0.9 cm (1.1 cm during dropouts). Fusion is 88 % better than the better single sensor. Estimated odometry bias 1.53 cm/s (true 1.50).

How to read this

Time runs left to right over 20 seconds. The thin solid line is where the object really is. Crosses are camera readings; hatched columns are dropouts where the camera sees nothing. The dashed line is odometry integrated from the start: smooth, but it wanders away as its bias accumulates. The thick line is the fused estimate, with a shaded ±2σ band showing how uncertain the Kalman filter believes it is. The band widens during each dropout and snaps back when the camera returns.

This mirrors Tactiverge's research question: when vision drops out, can local sensing such as force and joint feedback carry the estimate until it returns?

Assumptions & limitations
  • One dimension, a smooth known trajectory and a single object: real tracking is 3-D, with orientation, multiple objects and data association.
  • Noise is white Gaussian with the σ you set, and the Kalman filter is told the true σ values. Real filters must be tuned against noise they can only estimate.
  • Odometry error is a constant bias plus white noise; real drift also comes from slip, scale-factor error and temperature.
  • Dropouts are random bursts, independent of where the object is. Real occlusions often happen exactly when the task gets hard, for example when a gripper covers the object.
  • The camera has no latency and runs at the same 20 Hz as odometry; real cameras are slower and delayed, which the filter would have to compensate for.
  • Figures are from one seeded run of 401 samples; change the seed to see how much the numbers vary by chance.
Raise the dropout probability to simulate heavier occlusion and watch the camera-alone error grow while the fused estimate holds up. Then set odometry bias to zero and then to 3 cm/s to see how drift hurts dead reckoning. Compare the bar chart of errors (RMSE) for each estimate.

What the explorer shows

The camera alone is excellent when it can see and poor during dropouts, because it can only hold its last reading. Odometry alone never has gaps but wanders further from the truth over time. The fused estimate uses odometry to carry the position through the gaps and the camera to correct the drift whenever it reappears. It is usually better than either sensor alone. That is the whole argument for fusion: two sensors with different weaknesses can cover for each other.

A worked research question

Tactiverge's Project TV-01 is a proposed study built around exactly this problem. Its research question is: "Can inexpensive local force sensing compensate for intermittent visual information and improve cooperative robotic manipulation of unfamiliar deformable materials?" Notice how it names the failure modes from this lesson: intermittent visual information (occlusion and dropouts) and deformable materials (shapes that change). It proposes force sensing as the complementary sense. This is a question, not a finding. The study has no results, and nothing in this lesson is evidence that the approach works. It is here as an example of how understanding a sensor's failures leads directly to a testable engineering question.

Project

Programming project: a failure-mode report

Using the code from this module (Python standard library only):

  1. Build a 12 × 12 greyscale test image of a bright object on a dark background, and a pipeline that thresholds it, finds the largest region and prints its area and centroid.
  2. Lighting: multiply the image by gains from 1.0 down to 0.3 in steps of 0.1. Record at which gain the area first changes and at which the object disappears.
  3. Occlusion: set columns of the object to the background value, one column at a time, and record how the centroid moves.
  4. Noise: add random noise with random.gauss(0, sigma) for several values of sigma (use random.seed(1) so your results repeat). Record when false regions appear.
  5. Write a one-page report listing each failure mode, the condition at which it appeared, and one idea (a different sensor, a different method or a change to the setup) that might reduce it. Label every number as coming from your synthetic test image.

Deliverables

  • A Python file containing the pipeline and the three tests
  • Tables of results for lighting, occlusion and noise
  • A one-page failure-mode report with a mitigation idea for each failure

Knowledge check

Check your understanding

  1. 1. In the lighting example, the object went from fully detected at 70% light to completely missing at 50%. What does this suggest?
  2. 2. A gripper finger hides the right half of an object. What happens to the centroid measured from the visible pixels?
  3. 3. With f = 600 px, Z = 1 m and an exposure of 1/60 s, how much blur does an object moving at 1 m/s cause?
  4. 4. Why is estimating distance from known size unreliable for a towel?
  5. 5. Which statement about the TV-01 research question is accurate?

Go further