C201 Prompts: AI Assistant Prompts for Calibrating a Stereo Rig
These prompts hand one practical job each to an AI assistant (Claude, ChatGPT, Gemini or another). Paste your own files and values where the square brackets are. Each prompt states what it needs, which tool it targets, how to check what comes back, and the field guide page whose facts it relies on.
An assistant can misread a transform’s direction or invent a threshold as easily as a person can. The prompts tell it not to, and every one ends with a check you run yourself. Treat the output as a draft until that check passes.
Write a Kalibr target.yaml for my Aprilgrid
Section titled “Write a Kalibr target.yaml for my Aprilgrid”- Inputs: the grid’s tag counts and your measurements of the printed board.
- Tool: Kalibr.
- Relies on: target.yaml and Measuring a printed target.
- How to check:
tagSpacinglies between 0 and 1, every length has a decimal point, and after a calibration the target block at the end ofresults-cam.txtshows the same numbers.
Write a Kalibr target.yaml for an Aprilgrid. Kalibr's format has target_type 'aprilgrid',tagCols and tagRows (tag counts), tagSize (one tag's width across its black border, inmetres) and tagSpacing (the gap between tags divided by tagSize: a ratio, not a length).Lengths must be written with a decimal point.
My printed grid has [COLS] tags across and [ROWS] tags down. My measurements:- across [N] tags and the [N-1] gaps between them: [LENGTH] mm- one tag's outer black edge: [TAG] mm- one gap between neighbouring tags: [GAP] mm
Use the long measurement to cross-check the other two: n tags and n-1 gaps spantagSize x (n + (n-1) x tagSpacing). Show the arithmetic, say if the measurements disagree,and give the final YAML. Do not round to the size I asked the printer for.Plan my calibration recording
Section titled “Plan my calibration recording”- Inputs: each lens’s field of view, the image resolution, the target and the distance between the cameras.
- Tool: Kalibr or mrcal.
- Relies on: Calibration Targets and Calibration Sequences and Lesson 2.
- How to check: the plan has close-ups and tilted views for each camera, covers the image corners and edges, includes shared views, and cites a source for every number in it. Compare it with the checklist.
Plan a camera calibration recording for my fisheye stereo pair. Rig: [lens field of view,resolution, distance between the lenses]. Target: [Aprilgrid or chessboard, its size].Tool: [Kalibr or mrcal].
Follow these sourced rules and cite which one each step serves:- Kalibr's multiple-camera guide: the cameras stay fixed and the target moves; lower the camera rate to around 4 Hz while capturing.- mrcal's choreography study: close-ups matter most; head-on views give poor results, with diminishing returns at about 45 degrees of tilt; about 100 frames before returns diminish (a synthetic result for one lens); avoid extreme close-ups where the lens is non-central.- mrcal's guide: get close-ups for each camera individually, and also joint views both cameras see, from just far enough out.- The target must reach every part of both images, the corners above all.
Give me an ordered list of board positions and motions, and a way to confirm coverage whilerecording. Do not invent distances, frame counts or tolerances that are not in these rules;where my rig needs a number the rules do not give, say so.Audit the coverage of my calibration images
Section titled “Audit the coverage of my calibration images”- Inputs: a folder of calibration images per camera, and the target’s layout.
- Tool: OpenCV (
cv2.aruco), before running Kalibr or mrcal. - Relies on: Calibration Targets and Calibration Sequences (this prompt is adapted from the one there) and Judging a Calibration, check 1.
- How to check: run the script on a few images where you can see the board by eye, and confirm the plotted corners land on it. Compare its coverage map with the corner plot in Kalibr’s
report-cam.pdf.
Write a Python script with OpenCV (cv2.aruco) that audits a folder of calibration imagesbefore I calibrate. For each camera: detect the Aprilgrid or ChArUco corners in every image,plot all detected corners on one image-sized canvas, report the fraction of a 5 x 5 grid ofimage cells with no corners at all, and estimate each view's board tilt from its homography.Flag recordings with no corners in the image corners, or with almost only head-on views.For a stereo pair, also count the frames in which both cameras detected the board at thesame timestamp. My target: [type, rows, columns, tag or square size]. My folders: [paths].Choose a camera model for my lens
Section titled “Choose a camera model for my lens”- Inputs: the lens datasheet (field of view, projection if stated) and what your pipeline reads.
- Tool: Kalibr, OpenCV or mrcal.
- Relies on: Lens Projections and Distortion and Calibration Tools Compared.
- How to check: the recommended model appears in the field guide’s model table for your lens type and in the tool’s own model list, and your pipeline can read it.
Recommend a calibration model for each camera of my stereo rig. Lens: [datasheet field ofview, stated projection if any]. Calibration tool: [Kalibr, OpenCV or mrcal]. My downstreampipeline reads: [e.g. OpenCV fisheye / Kannala-Brandt, double sphere, pinhole + radtan].
Use only these facts:- Usenko, Demmel and Cremers (2018): a pinhole model with distortion performs suboptimally beyond about 120 degrees; Kannala-Brandt applied after a pinhole projection (Kalibr pinhole-equi, OpenCV fisheye) has a singularity at 90 degrees off axis, unsuitable near 180 degrees; double sphere was within 1% of KB 8's reprojection error on lenses from 122 to 195 degrees.- Kalibr's models: pinhole-radtan, pinhole-equi, pinhole-fov, omni-none, omni-radtan, eucm-none, ds-none. mrcal fits one model to all cameras in a run.- Use the model the pipeline consumes.Give the model name exactly as the tool spells it, and say what I lose if the pipeline'smodel differs from the best-fitting one.Review my Kalibr camera calibration
Section titled “Review my Kalibr camera calibration”- Inputs:
results-cam.txt,camchain.yaml,target.yaml, your measured lens spacing and a description of the report’s plots. - Tool: Kalibr.
- Relies on: results-cam.txt, report-cam.pdf and Lesson 4.
- How to check: go through each point the assistant raises against the files yourself. It must not have applied any pass mark; the field guide’s sources give none.
Here are my Kalibr results-cam.txt, camchain.yaml and target.yaml for a stereo pair, mycaliper measurement of the distance between the two lenses ([X] m), and what the reportshows: [corner plot coverage, polar error shape, observation graph].Kalibr's conventions: T_cn_cnm1 under cam1 is T_c1_c0 and maps cam0 coordinates to cam1coordinates; translations are in metres; the reprojection error line gives a mean and astandard deviation in x and y, in pixels; "+-" values are parameter standard deviations.
Check, and show your working:1. The target block in results-cam.txt matches target.yaml.2. The reprojection error means are close to zero and the spreads are similar for both cameras.3. Which parameters have large standard deviations relative to their values.4. The baseline norm of T_cn_cnm1 against my measured spacing, as a percentage.5. Each intrinsics and distortion_coeffs list has the right length for its model.6. What the plots I described suggest about coverage and model fit.Do not apply pass/fail thresholds; no calibration tool publishes one. List what looksinconsistent and why, most serious first.
[paste results-cam.txt][paste camchain.yaml][paste target.yaml]Convert my Kalibr camchain to OpenCV format
Section titled “Convert my Kalibr camchain to OpenCV format”- Inputs: a Kalibr
camchain.yamlfor a stereo pair. - Tool: OpenCV (
cv2andcv2.fisheye). - Relies on: the Kalibr workflow’s conversion prompt, camera_model and intrinsics and How Kalibr names transforms.
- How to check: the norm of the converted T equals the baseline norm in
results-cam.txt; projecting a few 3D points with Kalibr’s model and with the converted OpenCV model gives the same pixels.
Convert this Kalibr camchain.yaml for a stereo pair into OpenCV camera matrices anddistortion vectors, plus the R and T that cv2.stereoRectify (or cv2.fisheye.stereoRectify)expects. Kalibr's pinhole intrinsics are [fu, fv, pu, pv]. radtan coefficients are[k1, k2, p1, p2]. equidistant coefficients are [k1, k2, k3, k4] of the Kannala-Brandtmodel, which OpenCV implements in cv2.fisheye. T_cn_cnm1 under cam1 maps cam0 coordinatesto cam1 coordinates; OpenCV's stereo R and T bring points from the first camera's frame tothe second's.For each camera, say which OpenCV model you used and why. If a camera uses omni, ds or eucm,tell me there is no exact equivalent instead of approximating silently. Write Python thatloads the YAML, builds the matrices, and checks the conversion by projecting ten 3D pointswith both the Kalibr formulas and OpenCV and printing the pixel differences.
[paste camchain.yaml]Compare two calibrations of the same camera
Section titled “Compare two calibrations of the same camera”- Inputs: two calibrations of one camera from independent recordings.
- Tool: Python with OpenCV, or mrcal’s
mrcal-show-projection-diffif both were solved in mrcal. - Relies on: Judging a Calibration, check 4 (this prompt is adapted from the one on that page).
- How to check: comparing a calibration with itself gives zero everywhere; for two mrcal models, the script’s map agrees in shape with
mrcal-show-projection-diff.
Write a Python script that compares two camera calibrations of the same camera in pixelspace: grid the image, unproject each grid point with model A, project it with model B, andplot a heat map of the pixel difference, with the largest differences and where they sit.Accept OpenCV pinhole or fisheye models, or a Kalibr camchain.yaml. Do not compare theparameters one by one: high-order distortion coefficients can differ widely while theprojections stay nearly identical. Include a self-test that compares a model with itself.
[paste or describe model A and model B]Read my mrcal diagnostics and tell me what to record next
Section titled “Read my mrcal diagnostics and tell me what to record next”- Inputs: screenshots or descriptions of
mrcal-show-projection-uncertainty,mrcal-show-projection-diffandmrcal-show-residuals-board-observation, and the fitted board warp. - Tool: mrcal.
- Relies on: Judging a Calibration, Calibration Tools Compared and the lab, part B.
- How to check: each recommendation names the plot region that motivates it; record what it suggests and confirm the uncertainty map improves there.
Here are mrcal's diagnostics for one camera of my stereo pair: the projection uncertaintymap, the cross-validation diff between two independent dances, the worst boardobservations' residuals, and the fitted calobject_warp: [describe or attach].mrcal's documentation says: where uncertainty is poor, more chessboard observations areneeded in that area; if the models fit, the cross-validation diff is about the sum of thetwo uncertainties, and far above double the uncertainty suggests model errors; residualsshould show no pattern.Tell me whether the evidence points to too little coverage, a lens model that is toosimple, a warped or unstable board, non-central behaviour from close-ups, or a sync orrolling-shutter problem, and what to record next. Say which plot supports each conclusion.Sources
Section titled “Sources”- Field guide: Kalibr File Reference, Kalibr Workflow, Calibration Targets and Calibration Sequences, Judging a Calibration, Lens Projections and Distortion, Calibration Tools Compared.
- Kalibr wiki, ETH Zurich ASL: multiple-camera calibration, calibration targets and YAML formats.
- Kogan, D. mrcal: how to calibrate, optimal choreography and cross-validation.
- Usenko, V., Demmel, N. and Cremers, D. (2018). The double sphere camera model. 3DV.
- OpenCV calib3d module reference.