How a Camera Turns a Scene into Pixels
Look again at our parking-lot image.
How a Camera Turns a Scene into Pixels explained visually
Look again at our parking-lot image. English captions are optional and start off. The complete transcript follows the written lesson.
What you will learn
Look again at our parking-lot image.
Near and far spaces
Look at the same parking lot from the camera's point of view. Spaces near the camera appear wide, while spaces farther away appear narrow. Their painted lines seem to meet in the distance. The real spaces did not shrink. The camera mapped a three-dimensional scene onto a flat image.
The pinhole model
An ideal pinhole camera gives us a simple model of that mapping. Suppose a point is one meter to the right of the camera's optical axis, and the focal length is eight hundred pixels. At a depth of four meters, the point appears two hundred pixels to the right of the image center, more precisely called the principal point. At eight meters, the same sideways offset appears as one hundred pixels. We multiplied focal length by sideways distance and divided by depth. Doubling the depth halved this image offset.
Perspective and size
That is why a single number of pixels cannot represent the physical width of every space in this view. We can mark each space separately in image coordinates, then test our occupancy rule on both near and far spaces. If we need dimensions in meters, we need more information about the camera and the scene.
Real cameras
Real lenses can bend lines, and moving the camera changes the mapping. The pinhole model is a starting point, not a perfect description of every image. Next, we'll use calibration to check the real camera.
Worked example
With focal length expressed as 800 pixels, a point one meter to the side of the optical axis at four meters depth projects 200 pixels from the principal point in the ideal model. At eight meters depth, the same sideways offset projects only 100 pixels.
Quick check: test your understanding
Try it yourself: If depth doubles and sideways position stays fixed, what happens to the ideal projected offset?
Check the reasoning
It becomes half as large, assuming the same camera and projection model.
Can one pixel location uniquely determine a three-dimensional point?
No. Without additional information, it corresponds to a viewing ray rather than a unique depth.
How far from the principal point is fX/Z at f=800 pixels, X=1 m, Z=4 m?
200 pixels.
What happens when the same point is at Z=8 m?
The ideal offset is 100 pixels.
Further reading
Programming Computer Vision with Python — Jan Erik Solem.
Original ToolsInVision teaching examples. Editorial approach · Suggest a correction
Accessible referenceLesson 2 transcript228 words · Video transcript · Matches the published narration and captionsOpen transcript
Look at the same parking lot from the camera's point of view. Spaces near the camera appear wide, while spaces farther away appear narrow. Their painted lines seem to meet in the distance. The real spaces did not shrink. The camera mapped a three-dimensional scene onto a flat image.
An ideal pinhole camera gives us a simple model of that mapping. Suppose a point is one meter to the right of the camera's optical axis, and the focal length is eight hundred pixels. At a depth of four meters, the point appears two hundred pixels to the right of the image center, more precisely called the principal point. At eight meters, the same sideways offset appears as one hundred pixels. We multiplied focal length by sideways distance and divided by depth. Doubling the depth halved this image offset.
That is why a single number of pixels cannot represent the physical width of every space in this view. We can mark each space separately in image coordinates, then test our occupancy rule on both near and far spaces. If we need dimensions in meters, we need more information about the camera and the scene.
Real lenses can bend lines, and moving the camera changes the mapping. The pinhole model is a starting point, not a perfect description of every image. Next, we'll use calibration to check the real camera.