ROB-220 · Lesson 5 of 12 · 30 min
Cameras, depth cameras and radar
Cameras are the richest and cheapest sensors a robot can carry. A single image holds color, texture, text, faces and the shapes of thousands of objects, and modern vision algorithms turn those pixels into detections, maps and grasp points. Depth cameras add a distance to each pixel, and radar sees through rain, fog and dust that defeat optical sensors. This lesson treats these devices as sensors: how they form their measurements, what specifications matter and where they fail. The geometry of image formation, calibration and the algorithms built on top belong to ROB-330, Computer Vision for Robotics; here the goal is to choose and use the hardware well.
The camera as a sensor
A digital camera focuses light through a lens onto an image sensor, a grid of photosites that each convert incoming photons into charge. Almost all robot cameras use CMOS sensors, in which each pixel has its own amplifier and the image is read out row by row. Color is usually obtained with a Bayer filter: a mosaic of red, green and blue filters over the pixels, with twice as many green as red or blue, followed by demosaicing to estimate full color at every pixel. Monochrome cameras skip the filter and collect roughly three times more light, which is why many machine-vision and stereo cameras are monochrome.
The specifications that matter for robotics are resolution (pixels across and down), frame rate, field of view, which depends on lens focal length and sensor size, pixel size (larger pixels collect more light and give less noise in dim scenes), dynamic range (the ratio between the brightest and darkest detail captured in one image, important when a robot drives from a dark warehouse into sunlight), and the shutter type.
In these formulas w is the sensor width, f the focal length, p the pixel pitch and r the distance to the scene. The ground sample distance (GSD) is the size of the patch of the world that one pixel covers, the camera's equivalent of lidar beam spacing.
Worked problem
Field of view and pixel footprint
A camera has a sensor 5.6 mm wide with 1,920 pixels across, and a 4 mm lens. What is its horizontal field of view, and how big is one pixel's footprint on a box 3 m away?
Show solution
- FOV: \( 2\arctan(5.6/(2 \times 4)) = 2\arctan(0.70) = 70.0° \).
- Pixel pitch: \( 5.6/1920 = 2.92 \) µm.
- GSD: \( 3 \times 2.92 \times 10^{-6}/0.004 = 2.19 \times 10^{-3} \) m.
Answer: A 70° horizontal field of view, and each pixel covers about 2.2 mm at 3 m. A barcode with 1 mm bars would be at the limit of what the camera can resolve there.
Rolling and global shutters
How the sensor exposes its pixels matters enormously for a moving robot. A rolling shutter exposes and reads each row in turn, so the top of the image is captured a few milliseconds before the bottom. Moving objects lean, propellers bend into strange arcs, and fast camera rotations skew the whole image. A global shutter exposes every pixel at the same instant, so the image is a true snapshot. Global-shutter sensors cost more and traditionally have smaller dynamic range, but they are preferred for visual odometry, fast manipulation and anything where geometry must be exact. If a rolling-shutter camera is used, the readout time must be known and modeled.
Worked problem
Rolling-shutter skew
A rolling-shutter camera takes 20 ms to read out its 1,080 rows. It is mounted on a robot turning at 90 °/s, and its horizontal field of view of 70° spans 1,920 pixels. How far does a vertical edge shift between the top and bottom rows?
Show solution
- Rotation during readout: \( 90 \times 0.020 = 1.8° \).
- Pixels per degree: \( 1920/70 = 27.4 \).
- Shift: \( 1.8 \times 27.4 \approx 49 \) pixels.
Answer: About 49 pixels of skew between the top and bottom of the image, enough to badly corrupt feature matching unless the rolling shutter is modeled or a global-shutter camera is used.
Motion blur is a separate effect: during the exposure time each pixel integrates light from a moving scene. Keeping blur below about one pixel requires an exposure shorter than the time for the image to move one pixel, which in dim light forces a trade-off between blur and noise. Many robots add illumination, often infrared, to allow short exposures.
Depth cameras
Depth cameras produce an image in which each pixel holds a distance. Three principles are in common use, and each has a distinctive error pattern.
Stereo cameras use two cameras a known distance apart, the baseline b. A point in the scene appears in slightly different horizontal positions in the two images; this difference, the disparity d in pixels, is inversely proportional to depth. Passive stereo needs texture to match, so blank walls give holes; active stereo adds a projected infrared dot pattern to create texture. Stereo works outdoors in sunlight, but its depth error grows with the square of distance.
Worked problem
Stereo depth error at two ranges
A stereo camera has a 50 mm baseline and a focal length of 640 pixels, and its matching is accurate to about 0.2 pixel. What is the depth error at 1 m and at 4 m?
Show solution
- \( fb = 640 \times 0.05 = 32 \) pixel·m.
- At 1 m: \( \Delta Z = 1^2 \times 0.2/32 = 0.0063 \) m.
- At 4 m: \( \Delta Z = 16 \times 0.2/32 = 0.10 \) m. Disparity at 4 m is only \( 32/4 = 8 \) pixels.
Answer: About 6 mm at 1 m but about 10 cm at 4 m: sixteen times worse for four times the distance. Short-baseline stereo cameras are excellent at arm's length and poor across a room.
Structured-light cameras project a known pattern, such as stripes or a coded dot field, and compute depth by triangulating how the pattern deforms on surfaces. They give dense, accurate depth at short range indoors and are used for bin picking and inspection, but sunlight washes the pattern out.
Time-of-flight cameras flood the scene with modulated infrared light and measure, at each pixel, the phase shift of the returning signal, which gives distance. They produce depth for every pixel without needing texture and are fast, but suffer from multipath (light bouncing between surfaces in a corner inflates the depth), flying pixels at object edges, interference from sunlight, and phase wrapping: with modulation frequency \( f_m \), distances beyond \( c/(2f_m) \) alias back to short ranges.
| Depth principle | Works outdoors? | Needs texture? | Typical weakness |
|---|---|---|---|
| Passive stereo | Yes | Yes | Holes on blank surfaces; error grows with Z² |
| Active stereo (projected dots) | Partly | No (creates its own) | Pattern weakens in sunlight at range |
| Structured light | Poorly | No | Sunlight washes out the pattern |
| Time-of-flight camera | Limited | No | Multipath, flying pixels, phase wrapping |
Radar for robots
Radar (radio detection and ranging) works like lidar with radio waves. Because the wavelength is millimeters rather than nanometers, radar passes through rain, snow, fog, dust and smoke almost unaffected, works in total darkness and is cheap to mass-produce. Automotive radars at 76–81 GHz measure range and, through the Doppler effect, the radial velocity of each target directly, which is why every adaptive cruise control system uses one. Compact 60 GHz radar-on-chip modules are now used in robots and buildings for presence detection, people counting and even monitoring breathing.
Most robot and vehicle radars are FMCW: they transmit a chirp whose frequency rises linearly, mix the echo with the transmitted signal and measure the beat frequency, which is proportional to range. The range resolution depends only on the chirp bandwidth B, and the velocity follows from the Doppler shift.
Worked problem
Radar range resolution and Doppler
A 77 GHz radar uses a chirp bandwidth of 1 GHz. What is its range resolution? A target produces a Doppler shift of 5.13 kHz; what is its radial speed?
Show solution
- Range resolution: \( 3 \times 10^8/(2 \times 10^9) = 0.15 \) m.
- Wavelength: \( \lambda = 3 \times 10^8/77 \times 10^9 = 3.9 \) mm.
- Radial speed: \( 5130 \times 0.0039/2 = 10.0 \) m/s.
Answer: Targets 15 cm apart in range can be separated, and the target is approaching or receding at about 10 m/s (36 km/h).
Radar's weakness is angular resolution. Angle is measured with an array of antennas, and with only a few virtual channels the beam is several degrees wide, so a radar point cloud is sparse and blurry compared with lidar. Metal objects return strong echoes while people and animals return weak ones, and reflections off guardrails and floors create ghost targets. Newer imaging radars with hundreds of virtual channels are narrowing the gap. In robotics, radar is valued as a complement: when snow or dust blinds the lidar and cameras, the radar still sees.
Radar and other radio sensors are radio transmitters. In the United States, they must be authorized by the Federal Communications Commission (FCC), for example under Part 95 Subpart M for 76–81 GHz radar, Part 15 rules for 57–71 GHz devices and Part 15 Subpart F for ultra-wideband devices, and carry an FCC ID. Buying a certified module and keeping its antenna and settings unchanged keeps the authorization valid.
Choosing among perception sensors
Cameras give the most information per dollar but need computation and good light; lidar gives precise geometry independent of light but costs more and struggles in weather; radar gives velocity and weather robustness but coarse angle. The industry debate about whether self-driving cars need lidar is really an argument about how much computation and data can substitute for direct measurement. For a robot designer, the practical rule is to start from the failure modes that matter in the operating environment, a dusty mine, a glass-walled office, a snowy parking lot, and choose a set of sensors whose weaknesses do not overlap.
Common mistakes
MistakeUsing a rolling-shutter camera on a fast-turning robot without modeling readout time.
InsteadUse a global-shutter camera for fast motion, or model the row timing in the vision software.
MistakeExpecting a short-baseline stereo camera to be accurate across a large room.
InsteadStereo depth error grows with the square of distance; choose a wider baseline or another sensor for long range.
MistakeTrusting time-of-flight camera depth in corners and at object edges.
InsteadMultipath inflates depth in concave corners and flying pixels appear at edges; filter them out.
MistakeTreating a radar point as precisely located like a lidar point.
InsteadRadar angle resolution is often several degrees; use it for velocity and robustness, not fine geometry.
MistakeAssuming a structured-light camera will work in sunlight.
InsteadSunlight overwhelms the projected pattern; use stereo or lidar outdoors.
Summary and key terms
- Robot cameras use CMOS sensors; Bayer filters give color, while monochrome sensors collect more light.
- Field of view and ground sample distance follow from sensor size, focal length, pixel pitch and range.
- Rolling shutters skew moving scenes; global shutters capture every pixel at once.
- Stereo depth is \( Z = fb/d \), with error growing as \( Z^2 \); structured light and ToF cameras need no texture but suffer in sunlight.
- ToF cameras suffer multipath, flying pixels and phase wrapping.
- FMCW radar measures range and Doppler velocity, works in bad weather, but has coarse angular resolution.
- Radio sensors must be certified, and sensor sets should be chosen so their weaknesses do not overlap.
- CMOS image sensor
- An image sensor with an amplifier in every pixel, read out row by row.
- Bayer filter
- A mosaic of red, green and blue filters over a sensor's pixels.
- Ground sample distance
- The size of the scene patch covered by one pixel.
- Rolling shutter
- Exposure and readout of an image sensor one row at a time.
- Global shutter
- Simultaneous exposure of all pixels.
- Disparity
- The difference in image position of a point between two stereo cameras.
- Baseline
- The distance between the two cameras of a stereo pair.
- Structured light
- Depth sensing by projecting a known pattern and measuring its deformation.
- Multipath
- A signal reaching the sensor by more than one path, corrupting the range.
- Doppler shift
- The change in frequency of a wave reflected from a moving target.
Practice problems
Work each problem on paper first, then reveal the answer to check.
What is the horizontal FOV of a 6.4 mm-wide sensor behind an 8 mm lens?
Show answer
\( 2\arctan(0.4) \approx 43.6° \).
Why do many stereo cameras use monochrome sensors?
Show answer
Without a color filter, each pixel collects about three times more light, lowering noise.
A stereo pair has fb = 60 pixel·m. What depth corresponds to a disparity of 12 pixels?
Show answer
5 m.
In the same camera, what disparity does a point at 1.5 m produce?
Show answer
40 pixels.
A ToF camera modulates at 20 MHz. At what range does phase wrapping begin?
Show answer
\( c/(2f_m) = 3 \times 10^8/(4 \times 10^7) = 7.5 \) m.
What chirp bandwidth gives 4 cm radar range resolution?
Show answer
\( B = c/(2\Delta R) = 3.75 \) GHz.
Why does a radar still work in heavy fog when a lidar fails?
Show answer
Its millimeter wavelength passes through water droplets that scatter near-infrared light.
What image artifact does a rolling shutter produce on a fast-spinning propeller?
Show answer
The blades appear bent or curved because rows are captured at different times.
Name one advantage of active stereo over passive stereo.
Show answer
The projected pattern provides texture, so blank walls still give depth.
Which perception sensor directly measures each target's radial velocity?
Show answer
Radar (or FMCW lidar).
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.