The answersDownload the PDF
Worksheet

U11.2 Intrinsics and calibration

Vision · University · about 35 min

BugBotLab
NameClassDate

What this lesson is about

Focal length in pixels, the principal point, and measuring them from known geometry.

Questions 7 marks in all

  1. [1 mark]A 3.6 mm lens sits on a sensor 4.8 mm wide that produces images 640 pixels wide. What is the focal length in pixels?

  2. [1 mark]The 320 pixel wide BugBot image, with fx = 92.4, is downsampled to 160 pixels wide. What is fx for the small image, in pixels?

  3. [1 mark]What does a camera calibration actually compute?

    1. AA least squares fit of the intrinsics, distortion and target poses that minimises the reprojection error
    2. BThe focal length printed on the lens, converted to pixels
    3. CThe average colour of a chessboard under the room's lighting
    4. DThe exact centre of the image in pixels
  4. [1 mark]Every calibration image shows the chessboard square on to the camera. What goes wrong?

    1. AThe focal length and the target's distance trade off against each other, so the fit is degenerate
    2. BThe corners cannot be found to sub-pixel accuracy
    3. CThe principal point comes out at zero
    4. DNothing, square on is the most accurate view
  5. [1 mark]Four tags give tan(bearing) and the observed u - 160. The model u - 160 = f tan(bearing) is a line through the origin, fitted by least squares. What does this print?

    tans = [0.0, 30 / 70, -40 / 50, 40 / 30]
    offsets = [0.0, 40.0, -74.0, 123.0]
    f = sum(t * o for t, o in zip(tans, offsets)) / sum(t * t for t in tans)
    residuals = [round(o - f * t, 1) for t, o in zip(tans, offsets)]
    print(round(f, 1))
    print(residuals)
  6. [1 mark]Why does a tag straight ahead of the robot carry no information about f?

    1. AIts tan(bearing) is zero, so u - cx is zero whatever f is
    2. BA tag straight ahead is too close to measure
    3. CIt lies on the principal point, which is unknown
    4. DIts range is too large for a good fit
  7. [1 mark]A calibration reports a root mean square reprojection error of 1.4 pixels. What should you conclude?

    1. ASomething is wrong, such as blurred images, a target that was not flat, or too few angles
    2. BIt is a good calibration
    3. CThe camera needs a longer focal length
    4. DThe residual is irrelevant once the intrinsics are known

The task: measure the focal length

Four tags are on the mat at (100, 130), (130, 110), (60, 90) and (140, 70). The robot stands at (100, 40) facing along +y. Print focal length:, fitted in pixels, and field of view:, the full horizontal field of view in degrees that your focal length implies.

from bugbot import *
import math
connect()

ROBOT = (100.0, 40.0)
TAGS = {1: (100.0, 130.0), 2: (130.0, 110.0), 3: (60.0, 90.0), 4: (140.0, 70.0)}
set_cv("apriltag")
wait(0.3)

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/u11-2-intrinsics/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Print the residual of your fit: for each tag, the difference between the column you observed and the column your fitted f predicts. Is it under a pixel?
  2. Leave out tag 1, whose bearing is zero. Does the fit change? Explain why that point carried no information about f.
  3. Fit the principal point as well, by allowing an intercept in the straight line. What do you get, and is the difference from 160 meaningful given your residuals?