API docs

IMU data

An IMU is the motion sensor of a camera: an accelerometer and a gyroscope. The trajectory output needs IMU data on every input of the batch.

An input carries IMU data in its imu field. An input with imu also needs lens values in camera, as the camera profiles page describes.

The imu field

"imu": {
  "source": "csv",
  "url": "https://videos.example.com/kitchen-imu.csv",
  "clock_offset_s": 0.0,
  "imu_in_camera": {
    "rotation": [[1, 0, 0], [0, 1, 0], [0, 0, 1]],
    "translation_m": [0.0, 0.0, 0.0]
  }
}

The values above are an example.

FieldWhat it isMessage when the value breaks a rule
source"csv" for a CSV file at a link, or "embedded" for GoPro telemetry inside the video file.source must be "csv" or "embedded".
urlThe https link to the CSV file.url is required when source is csv and refused when source is embedded.
clock_offset_sThe seconds to add to the IMU times to get the video's times. See Clocks.clock_offset_s must be a number from -3600 to 3600.
imu_in_cameraWhere the IMU sits in the camera. See IMU in camera.imu_in_camera must be an object with exactly rotation and translation_m.
imu_in_camera.rotationThree rows of three numbers.rotation must be 3 rows of 3 numbers that form a rotation matrix.
imu_in_camera.translation_mThree numbers, in metres.translation_m must be 3 numbers from -10 to 10.

A missing source, clock_offset_s or imu_in_camera gets the message imu must be an object with source, clock_offset_s and imu_in_camera, and url when source is csv. A missing url gets the message of url in the table above.

The CSV link follows the link rules of the video link. A CSV link that the API cannot read gets 400, as a video link does. A CSV link that breaks one of the five rules fails the job at acceptance. The service downloads an IMU file of at most 256 MiB.

The CSV format: imu_csv_v1

A CSV file holds one row for each IMU sample. Each row holds the accelerometer and the gyroscope values at one time.

t,accel_x,accel_y,accel_z,gyro_x,gyro_y,gyro_z
1000000000,0.12,-9.79,0.31,0.002,-0.015,0.004
1005000000,0.15,-9.81,0.29,0.003,-0.014,0.004

The rows above are an example.

The file itself:

A file that breaks one of these rules makes the job fail.

Embedded GoPro telemetry

With "source": "embedded", the service reads the IMU data from the video file itself. The video file must carry GoPro telemetry in the GPMF format, as a GoPro camera writes it into its MP4 files.

If one of these rules is broken, the job fails.

The times of embedded samples come from the clock of the video file. So clock_offset_s is usually 0 with embedded telemetry.

Clocks

The service moves each IMU sample onto the clock of the video. It adds clock_offset_s to the sample's time:

time on the video's clock, in nanoseconds = t + clock_offset_s * 1,000,000,000

The result is rounded to a whole nanosecond. The video's clock is the presentation clock of the video file: the clock of the frames' presentation times.

A sample whose time on the video's clock equals the presentation time of the first frame lands on the first frame. For example, say your IMU logger read 1 second more than the video's clock at the same moment. Then clock_offset_s is -1.

The delivered file uses one clock for the frames and the IMU samples. The frames page describes that clock.

IMU in camera

imu_in_camera says where the IMU sits in the camera. Its rotation and translation_m map a point of the IMU frame into the optical frame of the displayed picture:

p_optical = rotation * p_imu + translation_m

An IMU that sits in the camera with the same axes as the optical frame has the rotation of the example above.

Checks at processing

The API checks only the field rules above. The service checks the IMU data when it processes the video. Each series, the accelerometer and the gyroscope, is checked on its own.

CheckRule
Samples keptSamples from 1 second before the first frame to 1 second after the last frame are kept. Other samples are dropped.
Samples near framesEach kept sample is at most 1 second from a frame.
Frames near samplesEach frame is at most 1 second from a kept sample. A series needs at least 2 kept samples.
AccelerometerThe median of the accelerometer's magnitude is from 9.0 to 10.6 metres per second squared.
GyroscopeThe largest magnitude of the gyroscope is at most 35 radians per second.
RateThe rate of each series is from 50 to 1,000 samples per second.

If one of these checks fails, the job fails.

The accelerometer check is why accel_x, accel_y and accel_z must include gravity. Without gravity, the median would be near 0.