# The Camera Definition: Every Fact With Its Source, and a Datasheet That Disagreed With Itself

> The camera definition step of a robot calibration cell: one table per part with a source for every value, the check that showed a fisheye lens's focal length and field-of-view figures could not both be true on its sensor, the facts that had to be measured instead, and a tested prompt.

Page: https://egocam.ai/robot-cell/camera-definition/

:::note[A record of one build]
Every number on this page was measured on the cell of the [case study](https://egocam.ai/robot-cell/) unless a source is given. It is one cell, one robot and eleven cameras: read it as experience, not as a standard.
:::

The camera definition is the one place the simulator, the path planner and the solver read the camera's facts from. In the [case study](https://egocam.ai/robot-cell/) it was written on day one from the maker's datasheet and the chip makers' pages, and its most useful output was a list of what nobody knew yet.

## The check that paid for the step

The datasheet gave a focal length of 2.26 mm and a field of view of 210 degrees diagonal, 190 horizontal and 118 vertical, on a sensor of 1920 x 1200 pixels of 3.0 micrometres. The two standard fisheye projections are on [Projections and Distortion](https://egocam.ai/lens-physics/projections-and-distortion/). Applying them both ways:

| | Equidistant, r = f x angle | Equisolid, r = 2 f sin(angle / 2) |
|---|---|---|
| Field of view that 2.26 mm (753 px) gives on this sensor | H 146, V 91, D 172 degrees | H 158, V 94, D 195 degrees |
| Focal length implied by H 190 degrees | 579 px | 651 px |
| Focal length implied by V 118 degrees | 583 px | 609 px |
| Focal length implied by D 210 degrees | 618 px | 713 px |

Under neither projection do the focal length and the field-of-view figures agree: they differ by 5 to 23 %. So the lens was written down as unknown, with 580 to 755 px as the range a solver should search. The calibrated focal length was 618 to 619 px.

In our experience, this is worth ten minutes on any lens. A solver started from the datasheet's 753 px would have been started 22 % off.

## What the datasheet did not say

| Fact | How it was found |
|---|---|
| Which stream is usable for calibration | The H.264 stream carries the IMU samples inside the video; the MJPEG stream carries none. See [Recording and stills](https://egocam.ai/robot-cell/recording-and-stills/) |
| The IMU's configured ranges | Measured against the robot's motion: 1024 counts per g and 8.192 counts per degree per second |
| Which controls exist | Listed from the camera itself: exposure can be locked by hand between 0.1 and 7 ms; there is no gain control |
| That the frame rate has a switch | A camera recorded at half the frame rate |
| The unit's own serial number | The USB descriptor's serial was identical on every unit; the unit's own serial sits in a vendor-specific camera control |
| Where the IMU is relative to the lenses | Still the least certain: see [Camera to IMU](https://egocam.ai/robot-cell/camera-imu/) |
| That the lenses are slightly off centre | Only a lens model with decentering terms gave the true baseline: see [The solve](https://egocam.ai/robot-cell/the-solve/) |

## Settings to lock

Resolution and frame rate, exposure by hand, and the stream format. In our experience, exposure is the one that silently unlocks: this camera returns to automatic exposure on every plug-in.

## The prompt

- **Inputs:** the maker's datasheet and anything you know from the design (baseline, axis directions).
- **How to check:** redo one row of each lens table by hand; every value has a source or says unknown; the list of unknowns names the step that needs each.

```text
Write the camera definition for calibrating a stereo camera with a built-in IMU. It is the single
place every later step reads the camera's facts from (the simulator, the path planner, the solver's
start values), so every value needs its source, and a value nobody has measured must say so.

Inputs: the maker's datasheet (pasted below) and what I know myself: [design baseline 60 mm lens to
lens, optical axes parallel, colour sensor].

Produce one table per part, each row = item, value, source:
1. Sensors and streams: sensor, shutter type, resolution per lens, pixel size, how the two images
  arrive (for example side by side in one frame), frame rates, stream formats and which of them is
  lossless.
2. IMU: chip, sample rate, how the samples reach the computer, full-scale ranges as the chip allows
  and as configured (if not stated: unknown).
3. Lens: focal length, f-number, field of view as stated.
4. Design geometry: baseline, axis directions, where the IMU sits relative to the left lens.
5. Settings that must be locked before recording (exposure, gain, frame rate, any in-camera
  processing) and why each one matters to calibration.

Look up the sensor's pixel size and the IMU's ranges and noise on the chip makers' own pages and
link them. If a page will not load, say so and mark the value "not read"; do not fill it from
memory.

Then check the lens numbers against each other, because datasheets often quote a focal length and
field-of-view figures that cannot both be true on this sensor:
- convert the focal length to pixels with the pixel size;
- under the equidistant projection (r = f * theta) and the equisolid projection (r = 2 f sin(theta /
  2)), compute the horizontal, vertical and diagonal field of view that this focal length gives on
  this sensor;
- going the other way, compute the focal length each stated field-of-view figure implies;
- check the three field-of-view figures against each other as well: two of them may agree with each
  other while the third is the lens's own limit rather than this sensor's;
- show all of it as tables. If the focal length and the field-of-view figures disagree by more than
  5 %, say so plainly, treat the lens as unknown, and give the range of focal lengths in pixels a
  solver should search: from the smallest to the largest value any of the figures implies, rounded
  outward to 5 px.

Recommend a lens model for the calibration, with the reason, and name one alternative.

End with a list of everything still unknown that a later step needs, and which step needs it. Do not
fill a gap with a typical value.

Datasheet:
[paste]
```

## How this prompt was tested

A fresh AI session got an earlier wording of this prompt with the datasheet's text. It reproduced the table above to the pixel (579, 583, 618, 651, 609, 713 px), stated that the lens must be treated as unknown, and recommended a start range of 580 to 755 px, which contains the 618 px later measured. It noticed something we had not written down: the horizontal and vertical figures agree with each other under the equidistant projection (579 and 583 px), and the diagonal figure is probably the lens's own limit rather than this sensor's. It recommended the Kannala-Brandt model with the double sphere model as the alternative; the cell ended on Kannala-Brandt with decentering terms after starting on double sphere.

The chip makers' datasheet files would not load for it, and it said so and marked those values as not read. The prompt now asks for exactly that.

## Sources

- [AR0234CS product page](https://www.onsemi.com/products/sensors/image-sensors/ar0234cs) — onsemi; pixel size and resolution.
- [ICM-45686 product page](https://invensense.tdk.com/products/motion-tracking/6-axis/icm-45686/) — TDK InvenSense; ranges and noise.
- [A Generic Camera Model and Calibration Method for Conventional, Wide-Angle, and Fish-Eye Lenses](https://doi.org/10.1109/TPAMI.2006.153) — Kannala and Brandt, IEEE TPAMI 2006.
- [The Double Sphere Camera Model](https://arxiv.org/abs/1807.08957v1) — Usenko, Demmel and Cremers, 3DV 2018.
