Pinhole Projection Calculator¶
Run the Pinhole Projection Calculator MicroSim Fullscreen
You can include this MicroSim on your website using the following iframe:
<iframe src="https://dmccreary.github.io/robot-arm/sims/pinhole-projection-calculator/main.html"
height="602px" width="100%" scrolling="no"></iframe>
Description¶
Move a point in front of a pinhole camera and watch the pixel where it lands. Then use the pinhole formula in six problems: five ask for a pixel coordinate, and one runs the formula backward from a pixel and a depth to a distance. Used in Chapter 14.
The camera has a focal length of 500 pixels and its principal point, the centre of the picture, is at (320, 240). A point at (X, Y, Z) metres in the camera's frame lands on the pixel
- u = 500 × X / Z + 320
- v = 500 × Y / Z + 240
X is to the right of the view axis, Y is below it, and Z is the depth along the view. Run backward, X = (u - 320) × Z / 500.
Lesson Plan¶
Grade level: Middle school and up (age 12+). Time: 10 to 15 minutes.
- Explore. Move the X slider and watch the pixel move sideways. Move the Y slider and watch it move up and down. Where is pixel (0, 0)?
- Change the depth. Set X to 0.10 m and Z to 0.50 m, and read u. Now double Z to 1.00 m. What happened to the distance of the pixel from the centre?
- Six problems. Choose Six problems in the menu. Work each one out, type the number and press Check. Pixel answers must be within 1 pixel, and the distance in problem 6 within 0.001 m. You get one attempt at each, and 5 of 6 is mastery.
- Think about it. Problem 6 needs the depth as well as the pixel. Why can a single camera picture not tell you how far away a point is?
The right-hand picture is a view from above, with the camera looking up the page. It is a schematic and is not drawn to scale: the sideways direction is stretched so that small movements can be seen.
Specification¶
The learning objective, evidence of mastery and content for this MicroSim are specified in Chapter 14: Cameras, Perception, and Learning from Demonstration.