Understand calibration and check a camera projection
Project known camera-space points into pixels using supplied intrinsics.
Opening the Python editor…
Requirements and learning goals
Before you start
- Basic coordinate geometry
- Python 3; no camera required
You will be able to
- Distinguish intrinsics from extrinsics
- Check projection numerically
- Identify what a real calibration must measure
The browser exercise above works without extra setup. The project brief below assumes the listed prerequisites and gives you a task and checks to perform. Need a guided first project?
Camera calibration connects image pixels to geometry. describe the lens and image projection; extrinsics describe the camera position and orientation. You need both to turn a detection into a location in your room. Here you will check a simple projection before trusting a camera-derived robot target.
Check the actual camera mode before applying intrinsics. A different resolution or crop can invalidate a calibration that worked in the twin.
Two calibrations, two jobs
Lens distortion adds another correction. Store intrinsics, extrinsics, and distortion parameters with the image resolution and a calibration ID.
For an ideal pinhole camera, a point (X, Y, Z) in camera coordinates projects to u = fx*X/Z + cx and v = fy*Y/Z + cy. This lesson uses optical axes: right, down, forward. cameras use a different viewing convention, so convert explicitly at that boundary.
Try a projection check
Save this as projection.py and run python3 projection.py. These supplied values describe an ideal camera. Passing the assertions checks the projection formula; it does not calibrate a physical camera.
fx = fy = 600.0
cx, cy = 320.0, 240.0
def project(x, y, z):
if z <= 0:
raise ValueError("point is behind camera")
return fx*x/z + cx, fy*y/z + cy
assert project(0, 0, 2) == (320, 240)
assert project(1, 0, 2) == (620, 240)
print("Projection checks passed")The center ray projects to the principal point. Moving right in camera coordinates moves right in the image.
Optional extension: measure a real calibration
Collect calibration-board views covering the image, estimate lens parameters, and check held-out reprojection error. Then estimate the camera's pose against surveyed world points. Use OpenCV's calibration functions, including distortion correction. This requires additional images and surveyed measurements; the next ray exercise supplies a synthetic camera pose so you can continue without hardware.
Check and extend
Validate world-position estimates at several distances and image corners. A small image reprojection error alone does not prove accurate world .
Common snag: changing resolution, cropping, focus, or camera mounting while retaining old calibration. Map detections back to calibrated image coordinates, or update intrinsics consistently. Optional extension: move the camera slightly and measure the resulting world-position error before recalibrating.
Before you move on
Can you do each of these?
- Distinguish intrinsics from extrinsics
- Check projection numerically
- Identify what a real calibration must measure
0 of 2 checkpoints solved. Try checkpoint 1