API docs

Camera profiles

Depth, trajectory and IMU data need the lens values of the camera that filmed the video. The lens values say how the camera maps the scene onto the pixels of the picture.

An input gives the lens values in its camera field, in one of two ways:

camera holds exactly one of the two. Otherwise the request gets 400 with the message camera must be an object with exactly one of profile and intrinsics.

An input without camera gets pii_blur only, and its pictures keep their own aspect ratio. The frames page shows both cases.

Name a profile

"camera": { "profile": "the-profile-name" }

State the lens values

"camera": {
  "intrinsics": {
    "model": "pinhole",
    "width": 1920,
    "height": 1080,
    "fx": 1400.0,
    "fy": 1400.0,
    "cx": 959.5,
    "cy": 539.5,
    "distortion": [-0.12, 0.03, 0.0, 0.0, 0.0],
    "rotation_deg": 0
  }
}

The values above are an example, not a real camera.

Stating lens values needs a switch on your organisation. The switch is off by default, and the service's staff turn it on. While it is off, intrinsics gets 400 with the param inputs[n].camera.intrinsics and the message This organisation may not state camera intrinsics. Name a camera profile instead.

intrinsics holds exactly the nine keys model, width, height, fx, fy, cx, cy, distortion and rotation_deg. A missing key gets 400 with the message intrinsics must be an object with exactly model, width, height, fx, fy, cx, cy, distortion and rotation_deg. An extra key gets 400 with the message This field is not accepted.

The rules

When a batch arrives, the API checks the keys in this order. The first broken rule answers 400, with the key's path as the param.

KeyMessage when the value breaks the rule
modelmodel must be "pinhole" or "fisheye".
widthwidth must be a whole number of at least 2.
heightheight must be a whole number of at least 2.
fxfx must be a number above 0.
fyfy must be a number above 0.
cxcx must be a number from 0 to width - 1.
cycy must be a number from 0 to height - 1.
distortiondistortion must be 5 numbers for pinhole or 4 numbers for fisheye.
rotation_degrotation_deg must be 0, 90, 180 or 270.

A whole number may be written in any JSON form of a whole number, such as 1920.0.

What the values mean

The two models are the pinhole and the fisheye models of OpenCV.

KeyMeaning
modelpinhole for the OpenCV pinhole model with its distortion. fisheye for the OpenCV fisheye model.
width, heightThe size of the picture as it is displayed, in pixels, after its rotation.
fx, fyThe focal lengths, in pixels.
cx, cyThe principal point, in pixels.
distortionpinhole: k1, k2, p1, p2, k3, in this order. fisheye: k1, k2, k3, k4.
rotation_degThe clockwise rotation for display that the video file states.

All pixel values refer to the displayed picture, after its rotation. The centre of a pixel is at a whole number, and the centre of the top-left pixel is at 0, 0.

A point at X, Y, Z in the camera's optical frame, with x to the right, y down and z forward, lands on the pixel u, v as follows:

x = X / Z
y = Y / Z
r2 = x * x + y * y

pinhole:
  radial = 1 + k1 * r2 + k2 * r2^2 + k3 * r2^3
  xd = x * radial + 2 * p1 * x * y + p2 * (r2 + 2 * x * x)
  yd = y * radial + p1 * (r2 + 2 * y * y) + 2 * p2 * x * y

fisheye:
  theta = atan(sqrt(r2))
  thetad = theta * (1 + k1 * theta^2 + k2 * theta^4 + k3 * theta^6 + k4 * theta^8)
  xd = x * thetad / sqrt(r2)
  yd = y * thetad / sqrt(r2)

u = fx * xd + cx
v = fy * yd + cy

For fisheye, a point on the optical axis, where r2 is 0, has xd = x and yd = y.

Checks at processing

The API checks only the rules above. The service checks more when it reads the video. If one of these checks fails, the job fails:

Published profiles

No camera profile is published yet.