Sensors and the Camera Model
What each sensor on a self-driving car measures and where it fails, how a camera turns the 3D world into pixels (the pinhole model, intrinsics and extrinsics), the car's camera in the simulator with perfect labels, and turning the camera view into a bird's-eye view.
Softmaxima Simulator StudioTry this topic's code in the Studio: it opens with the camera and trained networks project, ready to run.OpenIn plain words
A camera turns the 3D world into a flat picture: far things look small and high up, near things big and low down. If you know how high the camera is and how it is tilted, you can turn that back around and say where on the road each pixel is.
By the end of this topic you will be able to explain how a camera sees the road, and find where on the road a point in the image is.
Start with: the demo Try it: the car's camera, with perfect labels.
The sensors on a self-driving car
| Sensor | Measures | Strengths | Weaknesses |
|---|---|---|---|
| Camera | colour images, 30–60 per second | cheap, high resolution, reads signs, lights and lane paint | no direct distance; struggles in darkness, glare, heavy rain |
| Lidar | distance to millions of points per second, by timing laser pulses | accurate 3D shape, works at night | expensive; no colour; affected by heavy rain, fog and snow |
| Radar | distance and speed of objects, using radio waves | works in any weather; measures speed directly | coarse resolution; confused by metal objects such as signs |
| GPS (GNSS) | position on Earth | global, simple | only a few metres accurate alone; fails in tunnels and between tall buildings |
| IMU | acceleration and rotation rate | very fast, needs nothing outside the car | small errors add up quickly (drift) |
| Wheel encoders, ultrasonic | wheel rotation; distance to very near objects | cheap; useful for parking | short range; wheel slip |
No sensor is good at everything, so real cars use several and combine them (sensor fusion, Part 3). Some companies rely mainly on cameras; most robotaxis add lidar and radar. This part of the course focuses on the camera, because learning to see from images is where deep learning matters most.
The pinhole camera model
A camera maps a point in 3D to a pixel. In the simplest model, light from the point passes through one tiny hole and lands on the sensor. Using camera coordinates with Z pointing forward along the camera's axis, X to the right and Y down, a point (X, Y, Z) lands on pixel
Dividing by Z, the distance along the axis, is what makes far things look small. f is the focal length in pixels, and (cx, cy) is the image centre. These are the camera's intrinsics, usually written as a matrix K:
The extrinsics say where the camera sits on the car and which way it points: in our car, 1.4 m above the road, 1.6 m ahead of the rear axle, tilted 4° down. A point in the car's frame is first moved and rotated into the camera's frame, then projected with K. Real lenses also bend straight lines a little (lens distortion); calibration, usually by photographing a printed checkerboard from several angles, measures K and the distortion. Our simulated camera is perfect, so no calibration is needed.
Try it: the car's camera, with perfect labels
The car drives itself with an autopilot. Switch the view to see the labels the simulator knows for every pixel, and try different weather. Cars, pedestrians and traffic lights each get a box, taken from the pixels they actually cover, so hidden parts are not counted.
Interactive: this part runs in your browser.
Try it: field of view, height and pitch
A wide field of view sees more of the road at the sides but makes everything smaller. A higher camera sees further over other cars. Watch where the road point 20 m ahead lands.
Interactive: this part runs in your browser.
From the camera to a bird's-eye view
Lane lines that are parallel on the road meet at a point in the camera image, which makes them awkward to measure. If the road is flat and we know the camera's intrinsics and extrinsics, we can reverse the projection: for every cell of a top-down grid on the road, compute which pixel sees it, and copy that pixel's colour. This is inverse perspective mapping, and it gives a bird's-eye view where lane lines are parallel again and distances are in metres.
The trick only works for things on the road surface. A car or a pedestrian is not flat, so it gets stretched into a long smear. That is fine for lane finding, which is the next topic, and one reason why detecting objects needs different methods.
Quiz
1. Which sensor measures the speed of other cars directly and works in fog?
2. In the pinhole model, what happens to an object's size in the image if its distance doubles?
3. A 320-pixel-wide camera has a 90° field of view. What is its focal length in pixels?
4. Why does a car look smeared in a bird's-eye view made by inverse perspective mapping?
📚 Further reading
Trusted, mostly free sources: official documentation, well-known textbooks and courses. When you want to confirm or go deeper on anything here, start with these.
- Hartley & Zisserman: Multiple View Geometry in Computer Vision ↗ the classic reference on camera models and projection
- OpenCV: Camera calibration ↗ calibrating a real camera with a checkerboard